Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
- Trace:
- Add information about added clauses to Implication cards

- Tests:
- Port to cmdliner v2

# v3.7.2 (July 2026)

Requires Menhir 20211230 and OCaml 4.14 or above on Linux, Windows and
Expand Down
2 changes: 1 addition & 1 deletion elpi.opam
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ depends: [
"re" {>= "1.7.2"}
"ppx_deriving" {>= "4.3"}
"ANSITerminal" {with-test}
"cmdliner" {with-test & < "2.0"}
"cmdliner" {with-test & >= "2.0"}
"fileutils" {with-test}
"yojson" {with-test}
"dune" {>= "2.9.0"}
Expand Down
22 changes: 14 additions & 8 deletions tests/test.real.ml
Original file line number Diff line number Diff line change
Expand Up @@ -197,17 +197,19 @@ let main ln_nb sources plot timeout promote executables namef catskip timetool s
if ko_list = [] then exit 0 else exit 1

open Cmdliner
open Cmdliner.Term.Syntax

let runners =
let doc = "Run tests against $(docv)." in
Arg.(non_empty & opt_all non_dir_file [] & info ["runner"] ~docv:"RUNNER" ~doc)

let valid_category_parser c =
let valid_category =
let parser c =
if List.exists (fun (c',_) -> c = c') (Test.names ())
then `Ok c
else `Error ("unknown category " ^ c)

let valid_category = Arg.(valid_category_parser,conv_printer string)
then Ok c
else Error ("unknown category " ^ c)
and pp ppf p = Format.fprintf ppf "%s" p in
Arg.Conv.make ~docv:"category" ~parser ~pp ()

let namef =
let doc = "Run only tests with a name that matches $(docv)." in
Expand Down Expand Up @@ -254,10 +256,14 @@ let info =
|> List.map (fun (cat,ts) -> [ `I(cat,String.concat ", " ts) ])
|> List.concat in
let man = [`Blocks [`S "KNOWN TESTS" ; `Blocks tests ] ] in
(Term.info ~doc ~exits:Term.default_exits ~man "test") [@ warning "-A"]
(Cmd.info ~doc ~exits:Cmd.Exit.defaults ~man "test") [@ warning "-A"]
(* ocaml >= 4.08 | Cmd.info ~doc ~exits:Cmd.Exit.defaults ~man "test" *)
;;

let () =
(Term.exit @@ Term.eval (Term.(const main $ ln_nb $ src $ plot $ timeout $ promote $ runners $ namef $ catskip $ mem $ seed $ stop_on_first_error),info)) [@ warning "-A"]
(* ocaml >= 4.08 | exit @@ Cmd.eval (Cmd.v info Term.(const main $ src $ plot $ timeout $ runners $ namef $ catskip $ mem $ seed)) *)
let cmd =
Cmd.make info @@
let+ ln_nb and+ src and+ plot and+ timeout and+ promote and+ runners and+ namef and+ catskip and+ mem and+ seed and+ stop_on_first_error in
main ln_nb src plot timeout promote runners namef catskip mem seed stop_on_first_error [@ warning "-A"]
in
exit (Cmd.eval cmd)
Loading