You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make a test suite which tests user like cli options and try to verify whether results are correct.
(1) Use Command or similar to run stuff like cargo run -- <options or flags, for example cargo run -- -H index.
Or:
(2) Make the Clap App return from a function or similar and put the other items in main() also in a function (say A()). Then you can call the clap app with get_matches_from(...) and call A() without having to call main.
(+) Can be used as a normal test
(+) Does not rely on Command / OS semantics
(-) Is not fully run like a user since it doesn't call the sic executable
Choice:
As process::exit()/1 is used for some commands (e.g. after printing the license or a help command), I used (1) for the commands which do this; (2) would not have returned a value and instead quits out of testing for all tests in the particular suite.
A better solution than using process::exit()/1 shouldbe used in the future.
See tracking issue #? for this.
This issue tracks an initial version of the above; just enough to have some idea of whether 0.8.0 can be released.
foresterre
changed the title
Provide tests which run commands with options, flags like a user
Initial user-like testing (before release 0.8.0)
Nov 30, 2018
Make a test suite which tests user like cli options and try to verify whether results are correct.
(1) Use Command or similar to run stuff like
cargo run -- <options or flags
, for examplecargo run -- -H index
.Or:
(2) Make the Clap App return from a function or similar and put the other items in main() also in a function (say A()). Then you can call the clap app with get_matches_from(...) and call A() without having to call main.
Choice:
As process::exit()/1 is used for some commands (e.g. after printing the license or a help command), I used (1) for the commands which do this; (2) would not have returned a value and instead quits out of testing for all tests in the particular suite.
A better solution than using process::exit()/1 shouldbe used in the future.
See tracking issue #? for this.
This issue tracks an initial version of the above; just enough to have some idea of whether 0.8.0 can be released.
PR: #73, #74, #75
Succeeding tracking issue: #77
The text was updated successfully, but these errors were encountered: