diff --git a/examples/test_hello.rs b/examples/test_hello.rs deleted file mode 100644 index f38c4f6d1..000000000 --- a/examples/test_hello.rs +++ /dev/null @@ -1,6 +0,0 @@ -/// This function is only meant to be used as part of the test suite -/// as a simple, cross-platform executable with known output. - -fn main() { - println!("test-hello"); -} diff --git a/src/tests/test_known_external.rs b/src/tests/test_known_external.rs index 598fadf3a..30e65ab8f 100644 --- a/src/tests/test_known_external.rs +++ b/src/tests/test_known_external.rs @@ -1,17 +1,17 @@ -use crate::tests::{fail_test, run_test, TestResult}; +use crate::tests::{fail_test, run_test_contains, TestResult}; + +// cargo version prints a string of the form: +// cargo 1.60.0 (d1fd9fe2c 2022-03-01) #[test] fn known_external_runs() -> TestResult { - run_test( - r#"extern "cargo run" [-q, --example: string, ...args]; cargo run -q --example test_hello"#, - "test-hello", - ) + run_test_contains(r#"extern "cargo version" []; cargo version"#, "cargo") } #[test] fn known_external_unknown_flag() -> TestResult { fail_test( - r#"extern "cargo run" [-q, --example: string, ...args]; cargo run -d"#, + r#"extern "cargo version" []; cargo version --no-such-flag"#, "command doesn't have flag", ) } @@ -19,17 +19,17 @@ fn known_external_unknown_flag() -> TestResult { /// GitHub issues #5179, #4618 #[test] fn known_external_alias() -> TestResult { - run_test( - r#"extern "cargo run" [-q, --example: string, ...args]; alias cr = cargo run; cr -q --example test_hello"#, - "test-hello", + run_test_contains( + r#"extern "cargo version" []; alias cv = cargo version; cv"#, + "cargo", ) } /// GitHub issues #5179, #4618 #[test] fn known_external_subcommand_alias() -> TestResult { - run_test( - r#"extern "cargo run" [-q, --example: string, ...args]; alias c = cargo; c run -q --example test_hello"#, - "test-hello", + run_test_contains( + r#"extern "cargo version" []; alias c = cargo; c version"#, + "cargo", ) }