Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/sed/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ fn get_cmd_spec(
handler: compile_negation_command,
}),
'=' => Ok(CommandSpec {
n_addr: 1,
n_addr: 2,
handler: compile_empty_command,
}),
':' => Ok(CommandSpec {
Expand All @@ -1225,7 +1225,7 @@ fn get_cmd_spec(
handler: compile_end_group_command,
}),
'a' | 'i' => Ok(CommandSpec {
n_addr: 1,
n_addr: 2,
handler: compile_text_command,
}),
'b' | 't' => Ok(CommandSpec {
Expand Down
28 changes: 28 additions & 0 deletions tests/by-util/test_sed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,32 @@ tb"#,

// Check both POSIX and GNU parsing routines.


check_output_posix!(
text_simple_insert,
[
"-e",
r#"
2,4i\
extra
"#,
LINES1
]
);

check_output_posix!(
text_simple_append,
[
"-e",
r#"
2,4a\
extra
"#,
LINES1
]
);


check_output_posix!(
text_insert_quit,
[
Expand Down Expand Up @@ -772,6 +798,8 @@ fn write_two_files() -> std::io::Result<()> {
// =, l commands
check_output!(number_continuous, ["/l2_/=", LINES1, LINES2]);
check_output!(number_separate, ["-s", "/l._8/=", LINES1, LINES2]);
check_output!(number_range, ["-e", "10,12=", LINES1]); // Correct output but test is not passing
check_output!(number_range_out_of_bounds, ["-e", "47,60=", LINES1]);

check_output!(list_ascii, ["-n", "l 60", "input/ascii"]);
check_output!(list_empty, ["-n", "l 60", "input/empty"]);
Expand Down
17 changes: 17 additions & 0 deletions tests/fixtures/sed/output/number_range
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
l1_1
l1_2
l1_3
l1_4
l1_5
l1_6
l1_7
l1_8
l1_9
10
l1_10
11
l1_11
12
l1_12
l1_13
l1_14
14 changes: 14 additions & 0 deletions tests/fixtures/sed/output/number_range_out_of_bounds
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
l1_1
l1_2
l1_3
l1_4
l1_5
l1_6
l1_7
l1_8
l1_9
l1_10
l1_11
l1_12
l1_13
l1_14
17 changes: 17 additions & 0 deletions tests/fixtures/sed/output/text_simple_append
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
l1_1
l1_2
extra
l1_3
extra
l1_4
extra
l1_5
l1_6
l1_7
l1_8
l1_9
l1_10
l1_11
l1_12
l1_13
l1_14
17 changes: 17 additions & 0 deletions tests/fixtures/sed/output/text_simple_insert
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
l1_1
extra
l1_2
extra
l1_3
extra
l1_4
l1_5
l1_6
l1_7
l1_8
l1_9
l1_10
l1_11
l1_12
l1_13
l1_14
Loading