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

expand: replace while loop with constant time algorithm

This commit is contained in:
Sebastian Bentmar Holgersson 2023-01-03 21:27:20 +00:00 committed by Sylvestre Ledru
parent ddc6fabca0
commit 69d8729598
2 changed files with 33 additions and 20 deletions

View file

@ -350,21 +350,41 @@ fn test_ignore_initial_plus_slash_combination() {
}
#[test]
fn test_comma_with_plus_and_multi_character_values() {
fn test_comma_with_plus_1() {
new_ucmd!()
.args(&["--tabs=3,+6"])
.pipe_in("\taaa\tbbb\tccc")
.pipe_in("\t111\t222\t333")
.succeeds()
// 01234567890
.stdout_is(" aaa bbb ccc");
.stdout_is(" 111 222 333");
}
#[test]
fn test_comma_with_plus_and_multi_character_values() {
fn test_comma_with_plus_2() {
new_ucmd!()
.args(&["--tabs=3,+6"])
.pipe_in("\taaa\tbbb\tccc")
.args(&["--tabs=1,+5"])
.pipe_in("\ta\tb\tc")
.succeeds()
// 01234567890
.stdout_is(" aaa bbb ccc");
.stdout_is(" a b c");
}
#[test]
fn test_comma_with_plus_3() {
new_ucmd!()
.args(&["--tabs=2,+5"])
.pipe_in("a\tb\tc")
.succeeds()
// 01234567890
.stdout_is("a b c");
}
#[test]
fn test_comma_with_plus_4() {
new_ucmd!()
.args(&["--tabs=1,3,+5"])
.pipe_in("a\tb\tc")
.succeeds()
// 01234567890
.stdout_is("a b c");
}