-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from mbarbin/more-tests
Add tests - increase coverage
- Loading branch information
Showing
40 changed files
with
1,465 additions
and
767 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
"cmdliner", | ||
"janestreet", | ||
"odoc", | ||
"opam" | ||
"opam", | ||
"stringable" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
let%expect_test "Param.enum" = | ||
let%expect_test "Param.assoc" = | ||
let open Command.Std in | ||
require_does_raise [%here] (fun () -> | ||
let+ _ = Arg.named [ "a" ] (Param.assoc []) ~doc:"empty enum" in | ||
(() [@coverage off])); | ||
[%expect {| (Invalid_argument Command.Arg.enum) |}]; | ||
require_does_raise [%here] (fun () -> Param.assoc []); | ||
[%expect {| (Invalid_argument Command.Param.assoc) |}]; | ||
() | ||
;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Cmdlang cram tests | ||
|
||
In addition to expect tests we also have cram tests. The reason we have both is that some of the code is not easy to cover from pure OCaml code. | ||
|
||
It is not necessary that each piece of code in cmdlang be covered by both expect-tests AND cram-tests. In priority, we favor expect-tests (we prefer writing OCaml over bash). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
(executable | ||
(name main_base) | ||
(flags :standard -w +a-4-40-41-42-44-45-48-66 -warn-error +a) | ||
(libraries cmdlang_to_base core_unix.command_unix test_command) | ||
(libraries cmdlang_to_base core_unix.command_unix cram_test_command) | ||
(instrumentation | ||
(backend bisect_ppx)) | ||
(preprocess no_preprocessing)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let () = Command_unix.run (Cmdlang_to_base.Translate.unit Cram_test_command.Cmd.main) |
2 changes: 1 addition & 1 deletion
2
test/cram/deprecated/climate/bin/dune → test/cram/bin/climate/dune
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
(executable | ||
(name main_climate) | ||
(flags :standard -w +a-4-40-41-42-44-45-48-66 -warn-error +a) | ||
(libraries climate cmdlang_to_climate test_command) | ||
(libraries climate cmdlang_to_climate cram_test_command) | ||
(instrumentation | ||
(backend bisect_ppx)) | ||
(preprocess no_preprocessing)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
let () = | ||
Climate.Command.run (Cmdlang_to_climate.Translate.command Cram_test_command.Cmd.main) | ||
;; |
2 changes: 1 addition & 1 deletion
2
test/cram/deprecated/cmdliner/bin/dune → test/cram/bin/cmdliner/dune
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
(executable | ||
(name main_cmdliner) | ||
(flags :standard -w +a-4-40-41-42-44-45-48-66 -warn-error +a) | ||
(libraries cmdlang_to_cmdliner test_command) | ||
(libraries cmdlang_to_cmdliner cram_test_command) | ||
(instrumentation | ||
(backend bisect_ppx)) | ||
(preprocess no_preprocessing)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
let () = | ||
Cmdlang_to_cmdliner.run | ||
Cram_test_command.Cmd.main | ||
~name:Sys.argv.(0) | ||
~version:"%%VERSION%%" | ||
;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
Checking the help when there are no arguments. | ||
|
||
$ ./main_base.exe return --help | ||
return | ||
|
||
main_base.exe return | ||
|
||
=== flags === | ||
|
||
[-help], -? . print this help text and exit | ||
|
||
|
||
$ ./main_climate.exe return --help | ||
Usage: ./main_climate.exe return [OPTIONS] | ||
|
||
return | ||
|
||
Options: | ||
--help, -h Print help | ||
|
||
$ ./main_cmdliner.exe return --help=plain | ||
NAME | ||
./main_cmdliner.exe-return - return | ||
|
||
SYNOPSIS | ||
./main_cmdliner.exe return [OPTION]… | ||
|
||
COMMON OPTIONS | ||
--help[=FMT] (default=auto) | ||
Show this help in format FMT. The value FMT must be one of auto, | ||
pager, groff or plain. With auto, the format is pager or plain | ||
whenever the TERM env var is dumb or undefined. | ||
|
||
--version | ||
Show version information. | ||
|
||
EXIT STATUS | ||
./main_cmdliner.exe return exits with: | ||
|
||
0 on success. | ||
|
||
123 on indiscriminate errors reported on standard error. | ||
|
||
124 on command line parsing errors. | ||
|
||
125 on unexpected internal errors (bugs). | ||
|
||
SEE ALSO | ||
./main_cmdliner.exe(1) | ||
|
||
|
||
And run it too. | ||
|
||
$ ./main_base.exe return | ||
() | ||
|
||
$ ./main_climate.exe return | ||
() | ||
|
||
$ ./main_cmdliner.exe return | ||
() |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.