Skip to content

Commit

Permalink
feat: add --quiet
Browse files Browse the repository at this point in the history
close #57
  • Loading branch information
c-cube committed May 8, 2020
1 parent cffe0c6 commit 12bc9b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/core.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

(**** TOOLKIT ****)
module M = Misclex
let quiet = ref false
let fpf = Printf.fprintf let va = Printf.sprintf
let epf = Printf.eprintf let eps = prerr_string
let pl = print_endline
Expand Down
8 changes: 6 additions & 2 deletions src/qtest_bin.mll
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ let extract_from pathin = Lexing.(

(** Generate the test suite from files list on currently selected output *)
let generate paths =
eps "Extraction : "; List.iter extract_from paths;
if not !quiet then eps "Extraction : "; List.iter extract_from paths;
out "let ___tests = ref []\nlet ___add test = ___tests := test::!___tests\n";
out hard_coded_preamble;
out (Buffer.contents global_preamble);
Expand All @@ -244,7 +244,7 @@ let generate paths =
exit (QCheck_ounit.run (\"\" >::: List.rev !___tests))\n\
with Arg.Bad msg -> print_endline msg; exit 1\n\
| Arg.Help msg -> print_endline msg; exit 0";
eps "Done.\n"
if not !quiet then eps "Done.\n"

(** Parse command line *)

Expand Down Expand Up @@ -284,6 +284,10 @@ Only generate tests pertaining to this function, as indicated by the test header
"--shuffle", Arg.Unit (fun ()->toggle _shuffle; if !_shuffle then epf "!!! SHUFFLE is ON !!!\n"),
" (default: turned off) \
Toggle test execution order randomisation; submodules using injection are not shuffled";

"--quiet", Arg.Set quiet,
" (default: turned off) \
Suppress output on stderr";
]

let usage_msg =
Expand Down

0 comments on commit 12bc9b6

Please sign in to comment.