1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

tr: guard against regressions of class [:space:]

This commit is contained in:
Ben Wiederhake 2024-03-29 00:50:33 +01:00
parent 318a0f2927
commit 76a2f2128b

View file

@ -1283,3 +1283,19 @@ fn test_complement_flag_fails_with_more_than_two_operand() {
.fails() .fails()
.stderr_contains("extra operand 'c'"); .stderr_contains("extra operand 'c'");
} }
#[test]
fn check_regression_class_space() {
// This invocation checks:
// 1. that the [:space:] class has exactly 6 characters,
// 2. that the [:space:] class contains at least the given 6 characters (and therefore no other characters), and
// 3. that the given characters occur in exactly this order.
new_ucmd!()
.args(&["[:space:][:upper:]", "123456[:lower:]"])
// 0x0B = "\v" ("VERTICAL TAB")
// 0x0C = "\f" ("FEED FORWARD")
.pipe_in("A\t\n\u{0B}\u{0C}\r B")
.succeeds()
.no_stderr()
.stdout_only("a123456b");
}