Add tests for non-pattern-print on deletion - #535
Conversation
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
There was a problem hiding this comment.
Pull request overview
Adds regression tests to ensure sed commands that delete or replace the pattern space (d, address ranges with d, c, and multi-line D) do not result in unintended automatic printing, covering behavior reported in the earlier bugfix context (PR #256).
Changes:
- Add new unit tests validating output behavior for
don a single line and on a range. - Add a unit test validating
cdoesn’t result in unintended extra automatic printing. - Add a unit test covering
N;Dmulti-line deletion/restart behavior.
Suppressed comments (2)
tests/by-util/test_sed.rs:1265
- The final auto-printed line should include a trailing newline in this test suite’s expected behavior for non-newline-terminated input. As written, the expected output omits the final newline after
line3.
new_ucmd!()
.args(&["2c\\replaced"])
.pipe_in("line1\nline2\nline3")
.succeeds()
.stdout_is("line1\nreplaced\nline3");
tests/by-util/test_sed.rs:1255
- Like the previous test, this assertion likely needs a trailing newline in the expected output because default printing in this suite adds one even when the input’s last line is not newline-terminated.
new_ucmd!()
.args(&["2,3d"])
.pipe_in("line1\nline2\nline3\nline4")
.succeeds()
.stdout_is("line1\nline4");
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| new_ucmd!() | ||
| .args(&["2d"]) | ||
| .pipe_in("line1\nline2\nline3") | ||
| .succeeds() | ||
| .stdout_is("line1\nline3"); |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #535 +/- ##
=======================================
Coverage 83.18% 83.18%
=======================================
Files 13 13
Lines 7001 7001
Branches 398 398
=======================================
Hits 5824 5824
Misses 1174 1174
Partials 3 3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks! |
These are the tests from #256, which seems to have been fixed.