1
Fork 0

Fix tests

This commit is contained in:
Chris Denton 2021-12-22 18:31:36 +00:00
parent e100ec5bc7
commit 615604f0c7
No known key found for this signature in database
GPG key ID: 713472F2F45627DE
2 changed files with 11 additions and 3 deletions

View file

@ -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!(),
}