mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
@@ -278,3 +278,21 @@ fn test_suffix_implies_multiple() {
|
||||
.succeeds()
|
||||
.stdout_is("foo\no\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_emoji_handling() {
|
||||
new_ucmd!()
|
||||
.arg("/path/to/🦀.txt")
|
||||
.succeeds()
|
||||
.stdout_only("🦀.txt\n");
|
||||
|
||||
new_ucmd!()
|
||||
.arg("/🌍/path/to/🚀.exe")
|
||||
.succeeds()
|
||||
.stdout_only("🚀.exe\n");
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["/path/to/file🎯.emoji", ".emoji"])
|
||||
.succeeds()
|
||||
.stdout_only("file🎯\n");
|
||||
}
|
||||
|
||||
@@ -594,3 +594,19 @@ fn test_comm_arg_error() {
|
||||
.code_is(1)
|
||||
.stderr_is("error: the following required arguments were not provided:\n <FILE2>\n\nUsage: comm [OPTION]... FILE1 FILE2\n\nFor more information, try '--help'.\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn comm_emoji_sorted_inputs() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
|
||||
at.write("file1", "💐\n🦀\n");
|
||||
at.write("file2", "🦀\n🪽\n");
|
||||
|
||||
scene
|
||||
.ucmd()
|
||||
.args(&["file1", "file2"])
|
||||
.env("LC_ALL", "C.UTF-8")
|
||||
.succeeds()
|
||||
.stdout_only("💐\n\t\t🦀\n\t🪽\n");
|
||||
}
|
||||
|
||||
@@ -84,3 +84,21 @@ fn test_dirname_non_utf8_paths() {
|
||||
assert!(!output.is_empty());
|
||||
assert!(output.contains("test_"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_emoji_handling() {
|
||||
new_ucmd!()
|
||||
.arg("/🌍/path/to/🦀.txt")
|
||||
.succeeds()
|
||||
.stdout_is("/🌍/path/to\n");
|
||||
|
||||
new_ucmd!()
|
||||
.arg("/🎉/path/to/🚀/")
|
||||
.succeeds()
|
||||
.stdout_is("/🎉/path/to\n");
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["-z", "/🌟/emoji/path/🦋.file"])
|
||||
.succeeds()
|
||||
.stdout_is("/🌟/emoji/path\u{0}");
|
||||
}
|
||||
|
||||
@@ -785,3 +785,21 @@ fn test_escape_sequence_ctrl_c() {
|
||||
.success()
|
||||
.stdout_only("show");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_emoji_output() {
|
||||
new_ucmd!()
|
||||
.arg("Hello 🌍 World 🚀")
|
||||
.succeeds()
|
||||
.stdout_only("Hello 🌍 World 🚀\n");
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["-n", "Status: 🎯 Complete"])
|
||||
.succeeds()
|
||||
.stdout_only("Status: 🎯 Complete");
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["🦀", "loves", "🚀", "and", "🌟"])
|
||||
.succeeds()
|
||||
.stdout_only("🦀 loves 🚀 and 🌟\n");
|
||||
}
|
||||
|
||||
@@ -1755,6 +1755,17 @@ fn test_simulation_of_terminal_pty_pipes_into_data_and_sends_eot_automatically()
|
||||
std::assert_eq!(String::from_utf8_lossy(out.stderr()), "");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(windows))]
|
||||
fn test_emoji_env_vars() {
|
||||
new_ucmd!()
|
||||
.arg("🎯_VAR=Hello 🌍")
|
||||
.arg("printenv")
|
||||
.arg("🎯_VAR")
|
||||
.succeeds()
|
||||
.stdout_contains("Hello 🌍");
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn test_simulation_of_terminal_pty_write_in_data_and_sends_eot_automatically() {
|
||||
|
||||
@@ -58,6 +58,16 @@ fn test_simple_arithmetic() {
|
||||
.args(&["4", "/", "2"])
|
||||
.succeeds()
|
||||
.stdout_only("2\n");
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["4", "=", "2"])
|
||||
.fails_with_code(1)
|
||||
.stdout_only("0\n");
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["4", "=", "4"])
|
||||
.succeeds()
|
||||
.stdout_only("1\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1927,3 +1937,32 @@ mod gnu_expr_multibyte {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_emoji_operations() {
|
||||
new_ucmd!()
|
||||
.args(&["🚀", "=", "🚀"])
|
||||
.succeeds()
|
||||
.stdout_only("1\n");
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["🚀", "!=", "🚀"])
|
||||
.fails()
|
||||
.stdout_only("0\n");
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["🚀", "=", "🧨"])
|
||||
.fails()
|
||||
.stdout_only("0\n");
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["length", "🦀🚀🎯"])
|
||||
.env("LC_ALL", "fr_FR.UTF-8")
|
||||
.succeeds()
|
||||
.stdout_only("3\n");
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["🌍", "!=", "🌎"])
|
||||
.succeeds()
|
||||
.stdout_only("1\n");
|
||||
}
|
||||
|
||||
@@ -388,3 +388,12 @@ fn test_fmt_non_utf8_paths() {
|
||||
|
||||
ucmd.arg(&filename).succeeds();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fmt_reflow_unicode() {
|
||||
new_ucmd!()
|
||||
.args(&["-w", "4"])
|
||||
.pipe_in("漢字漢字 💐 日本語の文字\n")
|
||||
.succeeds()
|
||||
.stdout_is("漢字漢字\n💐\n日本語の文字\n");
|
||||
}
|
||||
|
||||
@@ -1453,3 +1453,11 @@ fn non_utf_8_input() {
|
||||
.fails()
|
||||
.stderr_contains("expected a numeric value");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_emoji_formatting() {
|
||||
new_ucmd!()
|
||||
.args(&["Status: %s 🎯 Count: %d\n", "Success 🚀", "42"])
|
||||
.succeeds()
|
||||
.stdout_only("Status: Success 🚀 🎯 Count: 42\n");
|
||||
}
|
||||
|
||||
@@ -4946,3 +4946,12 @@ fn test_dev_zero() {
|
||||
.succeeds()
|
||||
.stdout_only("\0");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tail_n_lines_with_emoji() {
|
||||
new_ucmd!()
|
||||
.args(&["-n", "1"])
|
||||
.pipe_in("a\n💐\n")
|
||||
.succeeds()
|
||||
.stdout_only("💐\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user