c
This commit is contained in:
24
sexpr.ml
24
sexpr.ml
@@ -1,15 +1,19 @@
|
|||||||
module Testing = struct
|
module type Testing = sig
|
||||||
type result = Pass | Fail | Skip
|
val test : string -> ?depends:(string list) -> (unit -> unit) -> unit;;
|
||||||
|
end;;
|
||||||
|
|
||||||
let testing = ref false
|
module Testing : Testing = struct
|
||||||
let test_only = ref []
|
type result = Pass | Fail | Skip;;
|
||||||
let test_results = ref []
|
|
||||||
|
let testing = ref false;;
|
||||||
|
let test_only = ref [];;
|
||||||
|
let test_results = ref [];;
|
||||||
|
|
||||||
let rec should_skip test =
|
let rec should_skip test =
|
||||||
match List.assoc_opt test !test_results with
|
match List.assoc_opt test !test_results with
|
||||||
Some Fail
|
Some Fail
|
||||||
| Some Skip -> true
|
| Some Skip -> true
|
||||||
| _ -> false
|
| _ -> false;;
|
||||||
|
|
||||||
let test name ?(depends = []) run =
|
let test name ?(depends = []) run =
|
||||||
let test_only = !test_only in
|
let test_only = !test_only in
|
||||||
@@ -33,7 +37,7 @@ module Testing = struct
|
|||||||
Fail
|
Fail
|
||||||
end; in
|
end; in
|
||||||
test_results := (name, res) :: !test_results
|
test_results := (name, res) :: !test_results
|
||||||
end
|
end;;
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
let rec proc args =
|
let rec proc args =
|
||||||
@@ -49,9 +53,9 @@ module Testing = struct
|
|||||||
| hd :: tl ->
|
| hd :: tl ->
|
||||||
proc tl
|
proc tl
|
||||||
end
|
end
|
||||||
in proc @@ Array.to_list Sys.argv
|
in proc @@ Array.to_list Sys.argv;;
|
||||||
end
|
end;;
|
||||||
let test = Testing.test
|
let test = Testing.test;;
|
||||||
|
|
||||||
|
|
||||||
module PC = struct
|
module PC = struct
|
||||||
|
Reference in New Issue
Block a user