diff options
| author | Chris Denton <christophersdenton@gmail.com> | 2021-12-22 18:31:36 +0000 |
|---|---|---|
| committer | Chris Denton <christophersdenton@gmail.com> | 2021-12-22 18:31:36 +0000 |
| commit | 615604f0c709e2b2e8edef2cf0b4418879b40aeb (patch) | |
| tree | 6334d14b8fe682980e3f1fa04ff7033f68367f59 /library/std/src/process/tests.rs | |
| parent | e100ec5bc7cd768ec17d75448b29c9ab4a39272b (diff) | |
| download | rust-615604f0c709e2b2e8edef2cf0b4418879b40aeb.tar.gz rust-615604f0c709e2b2e8edef2cf0b4418879b40aeb.zip | |
Fix tests
Diffstat (limited to 'library/std/src/process/tests.rs')
| -rw-r--r-- | library/std/src/process/tests.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/library/std/src/process/tests.rs b/library/std/src/process/tests.rs index 67b747e4107..61ab0eb55e6 100644 --- a/library/std/src/process/tests.rs +++ b/library/std/src/process/tests.rs @@ -4,6 +4,10 @@ use super::{Command, Output, Stdio}; use crate::io::ErrorKind; use crate::str; +fn known_command() -> Command { + if cfg!(windows) { Command::new("help") } else { Command::new("echo") } +} + #[cfg(target_os = "android")] fn shell_cmd() -> Command { Command::new("/system/bin/sh") @@ -305,7 +309,7 @@ fn test_interior_nul_in_progname_is_error() { #[test] fn test_interior_nul_in_arg_is_error() { - match Command::new("rustc").arg("has-some-\0\0s-inside").spawn() { + match known_command().arg("has-some-\0\0s-inside").spawn() { Err(e) => assert_eq!(e.kind(), ErrorKind::InvalidInput), Ok(_) => panic!(), } @@ -313,7 +317,7 @@ fn test_interior_nul_in_arg_is_error() { #[test] fn test_interior_nul_in_args_is_error() { - match Command::new("rustc").args(&["has-some-\0\0s-inside"]).spawn() { + match known_command().args(&["has-some-\0\0s-inside"]).spawn() { Err(e) => assert_eq!(e.kind(), ErrorKind::InvalidInput), Ok(_) => panic!(), } @@ -321,7 +325,7 @@ fn test_interior_nul_in_args_is_error() { #[test] fn test_interior_nul_in_current_dir_is_error() { - match Command::new("rustc").current_dir("has-some-\0\0s-inside").spawn() { + match known_command().current_dir("has-some-\0\0s-inside").spawn() { Err(e) => assert_eq!(e.kind(), ErrorKind::InvalidInput), Ok(_) => panic!(), } |
