forked from extern/nushell
Simplify known external tests (#5219)
* Simplify known external tests * Cargo fmt
This commit is contained in:
parent
c9f05f074a
commit
cf65f77b02
@ -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");
|
||||
}
|
@ -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",
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user