mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -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
|
||||
# #use "topfind";;
|
||||
# #require "containers";;
|
||||
# #require "containers-data";;
|
||||
# CCList.flat_map;;
|
||||
- : ('a -> 'b list) -> 'a list -> 'b list = <fun>
|
||||
# open Containers;; (* optional *)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ depends: [
|
|||
"base-threads"
|
||||
"dune-configurator"
|
||||
"containers" { = version }
|
||||
"iter" { with-test }
|
||||
"qtest" { with-test }
|
||||
"qcheck" { with-test }
|
||||
"ounit" { with-test }
|
||||
|
|
|
|||
2
dune
2
dune
|
|
@ -1,6 +1,6 @@
|
|||
(rule
|
||||
(targets README.md.corrected)
|
||||
(deps (package containers))
|
||||
(deps (package containers-data))
|
||||
(action (run ocaml-mdx test %{dep:README.md} -o %{targets})))
|
||||
|
||||
(alias
|
||||
|
|
|
|||
54
qtest/dune
54
qtest/dune
|
|
@ -1,16 +1,13 @@
|
|||
|
||||
(executable
|
||||
(name make)
|
||||
(modules make)
|
||||
)
|
||||
(flags :standard -warn-error -a)
|
||||
(modules make))
|
||||
|
||||
(rule
|
||||
(targets run_qtest.ml)
|
||||
(deps make.bc (source_tree ../src))
|
||||
;(libraries (qtest qcheck))
|
||||
(action
|
||||
(run ./make.bc -target %{targets}))
|
||||
)
|
||||
(action (run ./make.bc -target %{targets} ../src/core ../src/unix/)))
|
||||
|
||||
(executable
|
||||
(name run_qtest)
|
||||
|
|
@ -18,14 +15,45 @@
|
|||
(modules run_qtest)
|
||||
; disable some warnings in qtests
|
||||
(flags :standard -warn-error -a -w -3-33-35-27-39 -nolabels)
|
||||
(libraries iter gen qcheck containers containers.unix
|
||||
containers.data containers.thread containers.iter
|
||||
containers.sexp uutf)
|
||||
)
|
||||
(libraries iter gen qcheck containers containers.unix unix uutf))
|
||||
|
||||
(alias
|
||||
(name runtest)
|
||||
(deps run_qtest.exe)
|
||||
(action (run %{deps}))
|
||||
)
|
||||
(package containers)
|
||||
(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 =
|
||||
assert (not (is_suffix ~sub:"make.ml" file));
|
||||
str_sub ~sub:"Labels.ml" file ||
|
||||
is_suffix ~sub:"containers.ml" file ||
|
||||
is_suffix ~sub:"containers_top.ml" file ||
|
||||
is_suffix ~sub:"mkflags.ml" file ||
|
||||
|
|
@ -37,9 +38,11 @@ let list_files dir : string list =
|
|||
in
|
||||
f ~prefix:"" [] dir
|
||||
|
||||
let run_qtest target =
|
||||
let run_qtest target dirs =
|
||||
let files =
|
||||
list_files "../src/"
|
||||
dirs
|
||||
|> List.map list_files
|
||||
|> List.flatten
|
||||
|> List.map (Printf.sprintf "'%s'")
|
||||
|> String.concat " "
|
||||
in
|
||||
|
|
@ -51,8 +54,9 @@ let run_qtest target =
|
|||
|
||||
let () =
|
||||
let target = ref "" in
|
||||
let dirs = ref [] in
|
||||
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 Sys.command "which qtest > /dev/null" <> 0 then (
|
||||
(* create empty file *)
|
||||
|
|
@ -60,5 +64,5 @@ let () =
|
|||
output_string out "";
|
||||
close_out out;
|
||||
) else (
|
||||
run_qtest !target
|
||||
run_qtest !target !dirs
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
(library
|
||||
(name containers_thread)
|
||||
(public_name containers.thread)
|
||||
(public_name containers-thread)
|
||||
(wrapped false)
|
||||
(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))
|
||||
(libraries containers threads))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue