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

Re-evaluate tests::run::version_option test #114

Closed
robinkrahl opened this issue Aug 31, 2020 · 4 comments
Closed

Re-evaluate tests::run::version_option test #114

robinkrahl opened this issue Aug 31, 2020 · 4 comments

Comments

@robinkrahl
Copy link
Collaborator

The tests::run::version_option test is currently disabled because clap used to print the version output directly to stdout. This should be fixed (clap-rs/clap#1390, clap-rs/clap#1602), so we should check whether we can enable this test case.

@d-e-s-o
Copy link
Owner

d-e-s-o commented Aug 31, 2020

I think I checked this not too long ago and my conclusion was that the change is only in the clap 3 branch. So we'll have to wait. Can double check again later today.

@d-e-s-o
Copy link
Owner

d-e-s-o commented Aug 31, 2020

Confirmed the change is not present on v2-master and that the test still fails because data is printed to the real stdout.

--- src/tests/run.rs
+++ src/tests/run.rs
@@ -87,7 +87,6 @@ fn help_options() {
 }

 #[test]
-#[ignore]
 fn version_option() {
   // clap sends the version output directly to stdout: https://github.com/clap-rs/clap/issues/1390
   // Therefore we ignore this test for the time being.
@@ -100,6 +99,8 @@ fn version_option() {

     let s = String::from_utf8_lossy(&out).into_owned();
     let _ = re;
+    use std::io::Write;
+    writeln!(std::io::stdout(), "STDOUT: {}", s);
     assert!(re.is_match(&s), out);
   }
$ cargo test -- version_option --nocapture
running 1 test
nitrocli 0.3.3STDOUT:

thread 'tests::run::version_option' panicked at 'Box<Any>', src/tests/run.rs:104:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test tests::run::version_option ... FAILED

failures:

failures:
    tests::run::version_option

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 64 filtered out

error: test failed, to rerun pass '--bin nitrocli'

(that is with most recent structopt & clap at the time of writing)

@robinkrahl
Copy link
Collaborator Author

robinkrahl commented Aug 31, 2020 via email

@robinkrahl
Copy link
Collaborator Author

They consider this to be a feature, not a bug, so no backport for v2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants