-
Notifications
You must be signed in to change notification settings - Fork 21
Setting current_dir()
will affect the execution of assert_cli::Assert::main_binary()
#118
Comments
The "solution" from #116 was to use the assert_cmd crate instead, which future versions of assert_cli will be built up and that doesn't have this problem. |
Thank you for the quick reply. Sorry, I didn't see this closed issue. How about I leave this issue open? In case other people get confused when using assert_cli. (I spent hours to figure out what's wrong). |
Yeah, that sounds good to me. I've tagged this both "bug" and "assigned" so people can also see that we are working on this/have a solution we need to integrate. |
I found that I'm writing test cases for my CLI, should I use |
If you, like me, don't find
|
Mind creating an issue with this feedback so we can explore, what if anything, can be done to improve it?
Is building binaries as part of Are the paths working in this way an implementation detail that can change?
Granted, people were also interested in testing examples and so I assume an |
That's guaranteed for integration tests: https://users.rust-lang.org/t/how-do-you-test-binaries-not-libraries/9554/11
I think that's guaranteed as well. I bet at this point changing the layout of the target dir will break a ton of code in the wild, starting with Cargo's own tests.
I am not sure that recursively running Cargo during tests is a great idea. Even no-op Cargo-build is O(size of the project), and can easily get to the range of hundreds of milliseconds for large projects. Running the binaries directly should be the right approach. If that doesn't work for some reason, then opening a Cargo issue makes sense (but it does work for cargo itself).
Sure, will do! |
We have it documented how to cache the binary location so the use can make the call to cargo only once. |
assert_cli::Assert::main_binary()
will usecargo run --quiet --
to execute the CLI. However, if setting current directory outside the project (e.g.,/tmp
),cargo
will not find the corresponding binary.Since it is executed "--quiet", there is no output in stderr but returns a failure status.
Can we get the binary
assert_cli
version: 0.6.2The text was updated successfully, but these errors were encountered: