Skip to content

Commit

Permalink
no executable "echo" on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
cre4ture committed Jan 15, 2024
1 parent 0a6f9ad commit 2a5d891
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/by-util/test_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,19 +272,20 @@ fn modify_newlines_according_platform(input: &str) -> String {
}
}

#[cfg(not(target_os = "windows"))] // windows has no executable "echo", its only supported as part of a batch-file
#[test]
fn test_split_string_into_args_one_argument_no_quotes() {
let scene = TestScenario::new(util_name!());

let out = scene
.ucmd()
.arg("-S echo hello world") // this is the only case where the "echo" from windows behaves like the echo from unix
.arg("-S echo hello world")
.succeeds()
.stdout_move_str();
assert_eq!(out, modify_newlines_according_platform("hello world\n"));
}

#[cfg(not(target_os = "windows"))] // differences in behavior of "echo"
#[cfg(not(target_os = "windows"))] // windows has no executable "echo", its only supported as part of a batch-file
#[test]
fn test_split_string_into_args_one_argument() {
let scene = TestScenario::new(util_name!());
Expand All @@ -297,7 +298,7 @@ fn test_split_string_into_args_one_argument() {
assert_eq!(out, modify_newlines_according_platform("hello world\n"));
}

#[cfg(not(target_os = "windows"))] // differences in behavior of "echo"
#[cfg(not(target_os = "windows"))] // windows has no executable "echo", its only supported as part of a batch-file
#[test]
fn test_split_string_into_args_s_escaping_challenge() {
let scene = TestScenario::new(util_name!());
Expand Down

0 comments on commit 2a5d891

Please sign in to comment.