tests/fold: add tests for non-utf8 streams

This commit is contained in:
Phineas Jensen 2025-06-21 21:57:40 -06:00
parent cad7d0fe1b
commit faa6a9bb95
6 changed files with 71 additions and 0 deletions

View file

@ -554,3 +554,30 @@ fn test_obsolete_syntax() {
.succeeds()
.stdout_is("test1\n \ntest2\n \ntest3\n \ntest4\n \ntest5\n \ntest6\n ");
}
#[test]
fn test_byte_break_at_non_utf8_character() {
new_ucmd!()
.arg("-b")
.arg("-s")
.arg("-w")
.arg("40")
.arg("non_utf8.input")
.succeeds()
.stdout_is_fixture_bytes("non_utf8.expected");
}
#[test]
fn test_tab_advances_at_non_utf8_character() {
new_ucmd!()
.arg("-w8")
.arg("non_utf8_tab_stops.input")
.succeeds()
.stdout_is_fixture_bytes("non_utf8_tab_stops_w8.expected");
}
#[test]
fn test_all_tab_advances_at_non_utf8_character() {
new_ucmd!()
.arg("-w16")
.arg("non_utf8_tab_stops.input")
.succeeds()
.stdout_is_fixture_bytes("non_utf8_tab_stops_w16.expected");
}

2
tests/fixtures/fold/non_utf8.expected vendored Normal file
View file

@ -0,0 +1,2 @@
Alle Menschen sind frei und gleich an
Würde und Rechten geboren

1
tests/fixtures/fold/non_utf8.input vendored Normal file
View file

@ -0,0 +1 @@
Alle Menschen sind frei und gleich an Würde und Rechten geboren

View file

@ -0,0 +1,11 @@
タチ
タチツ
タチツテ
タチツテト
タチツテトナ
タチツテトナニ
タチツテトナニヌ
タチツテトナニヌネ
タチツテトナニヌ ネ
タチツテトナニヌ ネ ノ

View file

@ -0,0 +1,13 @@
タチ
タチツ
タチツテ
タチツテト
タチツテトナ
タチツテトナニ
タチツテトナニヌ
タチツテトナニヌネ
タチツテトナニヌ
タチツテトナニヌ
ネ ノ

View file

@ -0,0 +1,17 @@
А
АБ
АБВ
АБВГ
АБВГД
АБВГДЕ
АБВГДЕЖ
АБВГДЕЖЗ
АБВГДЕЖЗ
И
АБВГДЕЖЗ
И
АБВГДЕЖЗ
И
Й