add tests with emoji for various commands (#8545)

* add tests with emoji for various commands

* test/ls: use touch instead of an empty write

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
This commit is contained in:
Sylvestre Ledru
2025-09-03 09:57:04 +02:00
committed by GitHub
co-authored by Daniel Hofstetter
parent b766e8f54e
commit 5d9afe8bc7
4 changed files with 53 additions and 0 deletions
+14
View File
@@ -374,6 +374,20 @@ fn test_output_delimiter_with_adjacent_ranges() {
.stdout_only("ab:cd\n");
}
#[test]
fn test_emoji_delim() {
new_ucmd!()
.args(&["-d🗿", "-f1"])
.pipe_in("💐🗿🌹\n")
.succeeds()
.stdout_only("💐\n");
new_ucmd!()
.args(&["-d🗿", "-f2"])
.pipe_in("💐🗿🌹\n")
.succeeds()
.stdout_only("🌹\n");
}
#[cfg(target_os = "linux")]
#[test]
fn test_failed_write_is_reported() {
+14
View File
@@ -566,3 +566,17 @@ fn test_join_non_utf8_paths() {
.stdout_only("a 1 2\n");
}
}
#[test]
fn join_emoji_delim_inner_key() {
let ts = TestScenario::new(util_name!());
let at = &ts.fixtures;
at.write("file1", "a🗿b\n");
at.write("file2", "u🗿b\n");
ts.ucmd()
.args(&["-t🗿", "-1", "2", "-2", "2", "file1", "file2"])
.succeeds()
.stdout_only("b🗿a🗿u\n");
}
+16
View File
@@ -6147,3 +6147,19 @@ fn test_acl_display_symlink() {
.succeeds()
.stdout_matches(&re_with_acl);
}
#[test]
fn ls_emoji_alignment() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
at.touch("a");
at.touch("💐");
at.touch("");
scene
.ucmd()
.succeeds()
.stdout_contains("a")
.stdout_contains("💐")
.stdout_contains("");
}
+9
View File
@@ -799,3 +799,12 @@ fn test_args_override() {
.succeeds()
.stdout_is(" 5 57 302 alice_in_wonderland.txt\n");
}
#[test]
fn wc_w_words_with_emoji_separator() {
new_ucmd!()
.args(&["-w"])
.pipe_in("foo 💐 bar\n")
.succeeds()
.stdout_contains("3");
}