diff --git a/qtest/jbuild b/qtest/jbuild deleted file mode 100644 index a321fb6a..00000000 --- a/qtest/jbuild +++ /dev/null @@ -1,30 +0,0 @@ - -(executable - ((name make) - (modules (make)) - )) - -(rule - ((targets (run_qtest.ml)) - (deps (make.bc (files_recursively_in ../src))) - ;(libraries (qtest qcheck)) - (action - (run ./make.bc -target ${@})) - )) - -(executable - ((name run_qtest) - (modes (native)) - (modules (run_qtest)) - (flags (:standard -nolabels)) - (libraries (sequence gen qcheck containers containers.unix - containers.data containers.thread containers.iter - containers.sexp uutf)) - )) - -(alias - ((name runtest) - (deps (run_qtest.exe)) - (action (run ${<})) - )) - diff --git a/qtest/make.ml b/qtest/make.ml deleted file mode 100644 index 42b1bfd4..00000000 --- a/qtest/make.ml +++ /dev/null @@ -1,63 +0,0 @@ - -let str_sub ?(offset=0) ~sub:s' s = - let open String in - let rec aux i = - i= length s then false - else get s (i+j) = get s' j && aux_sub i (j+1) - in - aux offset - -let is_suffix ~sub s = - str_sub ~offset:(String.length s - String.length sub) ~sub s - -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)); - is_suffix ~sub:"containers.ml" file || - is_suffix ~sub:"containers_top.ml" file || - is_suffix ~sub:"mkflags.ml" file || - is_suffix ~sub:"utop.ml" file - -let prefix = "src" -let dirs = List.map (fun s-> Filename.concat prefix s) - -let list_files dir : string list = - let rec f ~prefix acc file = - let file = Filename.concat prefix file in - if Sys.is_directory file then ( - Array.fold_left (f ~prefix:file) acc (Sys.readdir file) - ) else ( - if is_code file && not (do_not_test file) then file :: acc else acc - ) - in - f ~prefix:"" [] dir - -let run_qtest target = - let files = - list_files "../src/" - |> List.map (Printf.sprintf "'%s'") - |> String.concat " " - in - let cmd = - Printf.sprintf "qtest extract --preamble 'open CCFun;;' -o %S %s 2>/dev/null" - target files - in - exit (Sys.command cmd) - -let () = - let target = ref "" in - Arg.parse ["-target", Arg.Set_string target, " set target"] - (fun _ -> ()) "make.ml -target file"; - if !target="" then failwith "please specify a target"; - if Sys.command "which qtest > /dev/null" <> 0 then ( - (* create empty file *) - let out = open_out !target in - output_string out ""; - close_out out; - ) else ( - run_qtest !target - ) diff --git a/src/core/CCString.ml b/src/core/CCString.ml index e073f781..0c69f47b 100644 --- a/src/core/CCString.ml +++ b/src/core/CCString.ml @@ -3,6 +3,10 @@ (** {1 Basic String Utils} *) +(*$inject + open CCFun;; + *) + type 'a gen = unit -> 'a option type 'a sequence = ('a -> unit) -> unit type 'a klist = unit -> [`Nil | `Cons of 'a * 'a klist] diff --git a/src/core/jbuild b/src/core/jbuild index 1f988b34..9f491ad8 100644 --- a/src/core/jbuild +++ b/src/core/jbuild @@ -6,4 +6,6 @@ (flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string -nolabels -open CCMonomorphic)) (ocamlopt_flags (:standard (:include ../flambda.flags))) (libraries (result uchar containers.monomorphic)) + (inline_tests ((backend qtest.lib) + (libraries (sequence gen uutf)))) )) diff --git a/src/data/jbuild b/src/data/jbuild index 3f5bf259..ae90f4dd 100644 --- a/src/data/jbuild +++ b/src/data/jbuild @@ -6,4 +6,6 @@ (flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string)) (ocamlopt_flags (:standard (:include ../flambda.flags))) (libraries (result)) + (inline_tests ((backend qtest.lib) + (libraries (sequence gen containers)))) )) diff --git a/src/iter/jbuild b/src/iter/jbuild index b2cab584..a004001b 100644 --- a/src/iter/jbuild +++ b/src/iter/jbuild @@ -6,4 +6,6 @@ (flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string)) (ocamlopt_flags (:standard (:include ../flambda.flags))) (libraries (result)) + (inline_tests ((backend qtest.lib) + (libraries (sequence gen containers)))) )) diff --git a/src/sexp/jbuild b/src/sexp/jbuild index 743e3b30..6fe203cd 100644 --- a/src/sexp/jbuild +++ b/src/sexp/jbuild @@ -6,6 +6,8 @@ (flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string)) (ocamlopt_flags (:standard (:include ../flambda.flags))) (libraries (result)) + (inline_tests ((backend qtest.lib) + (libraries (sequence gen containers)))) )) (ocamllex (CCSexp_lex)) diff --git a/src/threads/jbuild b/src/threads/jbuild index 7af8cbef..ae1d5005 100644 --- a/src/threads/jbuild +++ b/src/threads/jbuild @@ -7,5 +7,7 @@ (flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string)) (ocamlopt_flags (:standard (:include ../flambda.flags))) (libraries (containers threads)) + (inline_tests ((backend qtest.lib) + (libraries (sequence gen containers threads)))) )) diff --git a/src/unix/jbuild b/src/unix/jbuild index ef81a336..37b13f1c 100644 --- a/src/unix/jbuild +++ b/src/unix/jbuild @@ -7,4 +7,6 @@ (flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string)) (ocamlopt_flags (:standard (:include ../flambda.flags))) (libraries (result unix)) + (inline_tests ((backend qtest.lib) + (libraries (sequence gen containers unix threads)))) ))