Open emixa-d opened 2 years ago
To not fail there, the smoke
test would have to be modified to accept all args that the test harness can accept[^1], or better yet, have its logic modified to not fail when any args are given to it, like the following (I'd make a PR but it's unclear if it was intended that argv[0] aka exe name be passed to parse()
or not, even though in practice it should never be)
diff --git a/tests/smoke.rs b/tests/smoke.rs
index a46f9c0167ab307f..cf1dd1ca487db0e0 100644
--- a/tests/smoke.rs
+++ b/tests/smoke.rs
@@ -4,5 +4,9 @@ use std::env;
#[test]
fn main() {
- getopts::Options::new().parse(env::args()).unwrap();
+ // The test harness can be called with extra args which would panic here,
+ // such as --test-threads=16 -q
+ // thus pretending that it was called with no args, as usual, won't panic,
+ // ergo keeping the program name aka argument at index 0, just as before:
+ getopts::Options::new().parse(env::args().nth(0)).unwrap();
}
[^1]: which are those you can see via $ cargo test -- --help
When building
rust-getopts
with tests enabled on Guix, I got the following error message:Looks like
--test-threads
isn't supported yet.