Skip to content

Commit 25e269c

Browse files
jacob-greenfieldsylvestre
authored andcommitted
sort: generate test_start_buffer fixtures programmatically
1 parent 3651d73 commit 25e269c

File tree

5 files changed

+16
-9
lines changed

5 files changed

+16
-9
lines changed

tests/by-util/test_sort.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1909,7 +1909,22 @@ fn test_color_environment_variables() {
19091909
#[test]
19101910
fn test_start_buffer() {
19111911
// Test that a file with the exact same size as the start buffer is handled correctly
1912-
test_helper("start_buffer_b", &["start_buffer_a.txt"]);
1912+
const FILE_B: &[u8] = &[b'b'; 8_000];
1913+
const FILE_A: &[u8] = b"aaa";
1914+
1915+
let mut expected = FILE_A.to_vec();
1916+
expected.push(b'\n');
1917+
expected.extend_from_slice(FILE_B);
1918+
expected.push(b'\n');
1919+
1920+
let (at, mut ucmd) = at_and_ucmd!();
1921+
1922+
at.write_bytes("b", FILE_B);
1923+
at.write_bytes("a", FILE_A);
1924+
1925+
ucmd.args(&["b", "a"])
1926+
.succeeds()
1927+
.stdout_only_bytes(&expected);
19131928
}
19141929

19151930
/* spell-checker: enable */

tests/fixtures/sort/start_buffer_a.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/fixtures/sort/start_buffer_b.expected

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)