Skip to content

Commit 09805a5

Browse files
committed
Add simple test cases for x, g and G with empty hold space
1 parent b0d9a8d commit 09805a5

File tree

4 files changed

+48
-1
lines changed

4 files changed

+48
-1
lines changed

tests/by-util/test_sed.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ check_output!(trans_no_new_line, ["-e", r"y/l/L/", NO_NEW_LINE]);
352352
check_output!(trans_newline, ["-e", r"1N;2y/\n/X/", LINES1]);
353353

354354
////////////////////////////////////////////////////////////
355-
// Pattern space manipulation: D, d, H, h, N, n, P, p, q, x
355+
// Pattern space manipulation: D, d, H, h, N, n, P, p, q, x, g, G
356356
check_output!(pattern_print_to_newline, ["-n", r"1{;N;P;P;p;}", LINES1]);
357357
check_output!(pattern_next_print, ["-n", r"N;N;P", LINES1]);
358358
check_output!(pattern_delete_to_newline, ["-n", r"2N;3p;3D;3p", LINES1]);
@@ -371,6 +371,9 @@ check_output!(
371371
pattern_hold_append_swap,
372372
["-e", r"2h;3H;4g;5G;6x;6p;6x;6p", LINES1]
373373
);
374+
check_output!(pattern_swap_empty_hold, ["-e", r"4x", LINES1]);
375+
check_output!(pattern_replace_empty_hold, ["-e", r"4g;5g", LINES1]);
376+
check_output!(pattern_replace_append_empty_hold, ["-e", r"4G;5G", LINES1]);
374377
check_output!(pattern_next_output, ["-e", r"4n", LINES1]);
375378
check_output!(pattern_next_no_output, ["-n", "-e", r"4n", LINES1]);
376379
check_output!(pattern_next_print_output, ["-e", r"4n;p", LINES1]);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
l1_1
2+
l1_2
3+
l1_3
4+
l1_4
5+
6+
l1_5
7+
8+
l1_6
9+
l1_7
10+
l1_8
11+
l1_9
12+
l1_10
13+
l1_11
14+
l1_12
15+
l1_13
16+
l1_14
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
l1_1
2+
l1_2
3+
l1_3
4+
5+
6+
l1_6
7+
l1_7
8+
l1_8
9+
l1_9
10+
l1_10
11+
l1_11
12+
l1_12
13+
l1_13
14+
l1_14
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
l1_1
2+
l1_2
3+
l1_3
4+
5+
l1_5
6+
l1_6
7+
l1_7
8+
l1_8
9+
l1_9
10+
l1_10
11+
l1_11
12+
l1_12
13+
l1_13
14+
l1_14

0 commit comments

Comments
 (0)