Skip to content
Merged
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
41 changes: 41 additions & 0 deletions tests/by-util/test_sed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,47 @@ fn test_quit_now_exit_code() {
.stdout_is_fixture("output/pattern_quit");
}

// Test for delete command preventing automatic pattern printing
#[test]
fn test_delete_command_prevents_automatic_printing() {
// Test 'd' command - delete line 2
new_ucmd!()
.args(&["2d"])
.pipe_in("line1\nline2\nline3")
.succeeds()
.stdout_is("line1\nline3");
Comment on lines +1241 to +1245
}

#[test]
fn test_delete_range_prevents_automatic_printing() {
// Test 'd' command on range - delete lines 2-3
new_ucmd!()
.args(&["2,3d"])
.pipe_in("line1\nline2\nline3\nline4")
.succeeds()
.stdout_is("line1\nline4");
}

#[test]
fn test_change_command_prevents_automatic_printing() {
// Test 'c' command - change line 2
new_ucmd!()
.args(&["2c\\replaced"])
.pipe_in("line1\nline2\nline3")
.succeeds()
.stdout_is("line1\nreplaced\nline3");
}

#[test]
fn test_uppercase_delete_prevents_automatic_printing() {
// Test 'D' command - delete up to newline and restart
new_ucmd!()
.args(&["-e", "N", "-e", "D"])
.pipe_in("line1\nline2\nline3")
.succeeds()
.stdout_is("line3\n");
}

////////////////////////////////////////////////////////////
// Command blocks: {}
check_output!(
Expand Down
Loading