Skip to content

Commit

Permalink
Use "rustc" for testing Command args
Browse files Browse the repository at this point in the history
"echo" is not an application on Windows so `Command` tests could fail even if that's not what's being tested for.
  • Loading branch information
ChrisDenton committed Oct 30, 2021
1 parent 2b643e9 commit 07f54d9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions library/std/src/process/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,23 +297,23 @@ fn test_interior_nul_in_progname_is_error() {

#[test]
fn test_interior_nul_in_arg_is_error() {
match Command::new("echo").arg("has-some-\0\0s-inside").spawn() {
match Command::new("rustc").arg("has-some-\0\0s-inside").spawn() {
Err(e) => assert_eq!(e.kind(), ErrorKind::InvalidInput),
Ok(_) => panic!(),
}
}

#[test]
fn test_interior_nul_in_args_is_error() {
match Command::new("echo").args(&["has-some-\0\0s-inside"]).spawn() {
match Command::new("rustc").args(&["has-some-\0\0s-inside"]).spawn() {
Err(e) => assert_eq!(e.kind(), ErrorKind::InvalidInput),
Ok(_) => panic!(),
}
}

#[test]
fn test_interior_nul_in_current_dir_is_error() {
match Command::new("echo").current_dir("has-some-\0\0s-inside").spawn() {
match Command::new("rustc").current_dir("has-some-\0\0s-inside").spawn() {
Err(e) => assert_eq!(e.kind(), ErrorKind::InvalidInput),
Ok(_) => panic!(),
}
Expand Down

0 comments on commit 07f54d9

Please sign in to comment.