Skip to content

Add tests for non-pattern-print on deletion - #535

Merged
cakebaker merged 1 commit into
uutils:mainfrom
dspinellis:patter-delete-tests
Aug 21, 2026
Merged

Add tests for non-pattern-print on deletion#535
cakebaker merged 1 commit into
uutils:mainfrom
dspinellis:patter-delete-tests

Conversation

@dspinellis

Copy link
Copy Markdown
Collaborator

These are the tests from #256, which seems to have been fixed.

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
Copilot AI lite review requested due to automatic review settings August 21, 2026 06:50
@dspinellis dspinellis changed the title Add tests for non-pattern print on deletion Add tests for non-pattern-print on deletion Aug 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 d on a single line and on a range.
  • Add a unit test validating c doesn’t result in unintended extra automatic printing.
  • Add a unit test covering N;D multi-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.

Comment thread tests/by-util/test_sed.rs
Comment on lines +1241 to +1245
new_ucmd!()
.args(&["2d"])
.pipe_in("line1\nline2\nline3")
.succeeds()
.stdout_is("line1\nline3");
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.18%. Comparing base (79e5df0) to head (c7eb8a7).
⚠️ Report is 2 commits behind head on main.

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           
Flag Coverage Δ
macos_latest 83.83% <ø> (ø)
ubuntu_latest 84.03% <ø> (ø)
windows_latest 0.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cakebaker
cakebaker merged commit e858951 into uutils:main Aug 21, 2026
31 checks passed
@cakebaker

Copy link
Copy Markdown
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants