Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial user-like testing (before release 0.8.0) #71

Closed
foresterre opened this issue Nov 22, 2018 · 2 comments
Closed

Initial user-like testing (before release 0.8.0) #71

foresterre opened this issue Nov 22, 2018 · 2 comments
Assignees
Labels
C-enhancement Category: enhancements
Milestone

Comments

@foresterre
Copy link
Owner

foresterre commented Nov 22, 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 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.


PR: #73, #74, #75
Succeeding tracking issue: #77

@foresterre foresterre self-assigned this Nov 23, 2018
@foresterre foresterre added the C-enhancement Category: enhancements label Nov 23, 2018
@foresterre
Copy link
Owner Author

foresterre commented Nov 26, 2018

Initial work: #73, makes it possible to run the application with custom arguments like described in option (2).

@foresterre
Copy link
Owner Author

As #75 was merged to master; future updates and plans will happen in #77.

@foresterre 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: enhancements
Projects
None yet
Development

No branches or pull requests

1 participant