mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
chore: update tests to accomodate for split into several libs
This commit is contained in:
parent
b1b5d31665
commit
a2d07e4028
6 changed files with 54 additions and 20 deletions
|
|
@ -172,6 +172,7 @@ In a toplevel, using ocamlfind:
|
||||||
```ocaml
|
```ocaml
|
||||||
# #use "topfind";;
|
# #use "topfind";;
|
||||||
# #require "containers";;
|
# #require "containers";;
|
||||||
|
# #require "containers-data";;
|
||||||
# CCList.flat_map;;
|
# CCList.flat_map;;
|
||||||
- : ('a -> 'b list) -> 'a list -> 'b list = <fun>
|
- : ('a -> 'b list) -> 'a list -> 'b list = <fun>
|
||||||
# open Containers;; (* optional *)
|
# open Containers;; (* optional *)
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ depends: [
|
||||||
"base-threads"
|
"base-threads"
|
||||||
"dune-configurator"
|
"dune-configurator"
|
||||||
"containers" { = version }
|
"containers" { = version }
|
||||||
|
"iter" { with-test }
|
||||||
"qtest" { with-test }
|
"qtest" { with-test }
|
||||||
"qcheck" { with-test }
|
"qcheck" { with-test }
|
||||||
"ounit" { with-test }
|
"ounit" { with-test }
|
||||||
|
|
|
||||||
2
dune
2
dune
|
|
@ -1,6 +1,6 @@
|
||||||
(rule
|
(rule
|
||||||
(targets README.md.corrected)
|
(targets README.md.corrected)
|
||||||
(deps (package containers))
|
(deps (package containers-data))
|
||||||
(action (run ocaml-mdx test %{dep:README.md} -o %{targets})))
|
(action (run ocaml-mdx test %{dep:README.md} -o %{targets})))
|
||||||
|
|
||||||
(alias
|
(alias
|
||||||
|
|
|
||||||
54
qtest/dune
54
qtest/dune
|
|
@ -1,16 +1,13 @@
|
||||||
|
|
||||||
(executable
|
(executable
|
||||||
(name make)
|
(name make)
|
||||||
(modules make)
|
(flags :standard -warn-error -a)
|
||||||
)
|
(modules make))
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(targets run_qtest.ml)
|
(targets run_qtest.ml)
|
||||||
(deps make.bc (source_tree ../src))
|
(deps make.bc (source_tree ../src))
|
||||||
;(libraries (qtest qcheck))
|
(action (run ./make.bc -target %{targets} ../src/core ../src/unix/)))
|
||||||
(action
|
|
||||||
(run ./make.bc -target %{targets}))
|
|
||||||
)
|
|
||||||
|
|
||||||
(executable
|
(executable
|
||||||
(name run_qtest)
|
(name run_qtest)
|
||||||
|
|
@ -18,14 +15,45 @@
|
||||||
(modules run_qtest)
|
(modules run_qtest)
|
||||||
; disable some warnings in qtests
|
; disable some warnings in qtests
|
||||||
(flags :standard -warn-error -a -w -3-33-35-27-39 -nolabels)
|
(flags :standard -warn-error -a -w -3-33-35-27-39 -nolabels)
|
||||||
(libraries iter gen qcheck containers containers.unix
|
(libraries iter gen qcheck containers containers.unix unix uutf))
|
||||||
containers.data containers.thread containers.iter
|
|
||||||
containers.sexp uutf)
|
|
||||||
)
|
|
||||||
|
|
||||||
(alias
|
(alias
|
||||||
(name runtest)
|
(name runtest)
|
||||||
(deps run_qtest.exe)
|
(package containers)
|
||||||
(action (run %{deps}))
|
(action (run ./run_qtest.exe)))
|
||||||
)
|
|
||||||
|
|
||||||
|
(rule
|
||||||
|
(targets run_qtest_data.ml)
|
||||||
|
(deps make.bc (source_tree ../src/data))
|
||||||
|
(action (run ./make.bc -target %{targets} ../src/data)))
|
||||||
|
|
||||||
|
(executable
|
||||||
|
(name run_qtest_data)
|
||||||
|
(modes native)
|
||||||
|
(modules run_qtest_data)
|
||||||
|
; disable some warnings in qtests
|
||||||
|
(flags :standard -warn-error -a -w -3-33-35-27-39)
|
||||||
|
(libraries iter gen qcheck containers containers-data))
|
||||||
|
|
||||||
|
(alias
|
||||||
|
(name runtest)
|
||||||
|
(package containers-data)
|
||||||
|
(action (run ./run_qtest_data.exe)))
|
||||||
|
|
||||||
|
(rule
|
||||||
|
(targets run_qtest_thread.ml)
|
||||||
|
(deps make.bc (source_tree ../src/threads))
|
||||||
|
(action (run ./make.bc -target %{targets} ../src/threads)))
|
||||||
|
|
||||||
|
(executable
|
||||||
|
(name run_qtest_thread)
|
||||||
|
(modes native)
|
||||||
|
(modules run_qtest_thread)
|
||||||
|
; disable some warnings in qtests
|
||||||
|
(flags :standard -warn-error -a -w -3-33-35-27-39)
|
||||||
|
(libraries qcheck containers containers-thread iter threads))
|
||||||
|
|
||||||
|
(alias
|
||||||
|
(name runtest)
|
||||||
|
(package containers-thread)
|
||||||
|
(action (run ./run_qtest_thread.exe)))
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ let is_code file = is_suffix ~sub:".ml" file || is_suffix ~sub:".mli" file
|
||||||
|
|
||||||
let do_not_test file =
|
let do_not_test file =
|
||||||
assert (not (is_suffix ~sub:"make.ml" file));
|
assert (not (is_suffix ~sub:"make.ml" file));
|
||||||
|
str_sub ~sub:"Labels.ml" file ||
|
||||||
is_suffix ~sub:"containers.ml" file ||
|
is_suffix ~sub:"containers.ml" file ||
|
||||||
is_suffix ~sub:"containers_top.ml" file ||
|
is_suffix ~sub:"containers_top.ml" file ||
|
||||||
is_suffix ~sub:"mkflags.ml" file ||
|
is_suffix ~sub:"mkflags.ml" file ||
|
||||||
|
|
@ -37,9 +38,11 @@ let list_files dir : string list =
|
||||||
in
|
in
|
||||||
f ~prefix:"" [] dir
|
f ~prefix:"" [] dir
|
||||||
|
|
||||||
let run_qtest target =
|
let run_qtest target dirs =
|
||||||
let files =
|
let files =
|
||||||
list_files "../src/"
|
dirs
|
||||||
|
|> List.map list_files
|
||||||
|
|> List.flatten
|
||||||
|> List.map (Printf.sprintf "'%s'")
|
|> List.map (Printf.sprintf "'%s'")
|
||||||
|> String.concat " "
|
|> String.concat " "
|
||||||
in
|
in
|
||||||
|
|
@ -51,8 +54,9 @@ let run_qtest target =
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
let target = ref "" in
|
let target = ref "" in
|
||||||
|
let dirs = ref [] in
|
||||||
Arg.parse ["-target", Arg.Set_string target, " set target"]
|
Arg.parse ["-target", Arg.Set_string target, " set target"]
|
||||||
(fun _ -> ()) "make.ml -target file";
|
(fun d -> dirs := d :: !dirs) "make.ml -target file dir+";
|
||||||
if !target="" then failwith "please specify a target";
|
if !target="" then failwith "please specify a target";
|
||||||
if Sys.command "which qtest > /dev/null" <> 0 then (
|
if Sys.command "which qtest > /dev/null" <> 0 then (
|
||||||
(* create empty file *)
|
(* create empty file *)
|
||||||
|
|
@ -60,5 +64,5 @@ let () =
|
||||||
output_string out "";
|
output_string out "";
|
||||||
close_out out;
|
close_out out;
|
||||||
) else (
|
) else (
|
||||||
run_qtest !target
|
run_qtest !target !dirs
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
|
|
||||||
(library
|
(library
|
||||||
(name containers_thread)
|
(name containers_thread)
|
||||||
(public_name containers.thread)
|
(public_name containers-thread)
|
||||||
(wrapped false)
|
(wrapped false)
|
||||||
(optional)
|
(optional)
|
||||||
(flags :standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string -open CCShims_)
|
(flags :standard -warn-error -a+8 -safe-string -open CCShims_)
|
||||||
(ocamlopt_flags :standard (:include ../flambda.flags))
|
(ocamlopt_flags :standard (:include ../flambda.flags))
|
||||||
(libraries containers threads))
|
(libraries containers threads))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue