Repository navigation
sed: skip only spaces and tabs between script tokens - #665
Himanshu-singh04 wants to merge 6 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #665 +/- ##
=======================================
Coverage 95.43% 95.43%
=======================================
Files 14 14
Lines 7730 7737 +7
Branches 460 461 +1
=======================================
+ Hits 7377 7384 +7
Misses 352 352
Partials 1 1
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:
|
|
|
||
| #[test] | ||
| fn test_script_parser_skips_only_space_and_tab() { | ||
| new_ucmd!().arg("p\r").fails().code_is(1); |
There was a problem hiding this comment.
please also check the error message, not only the exit code
There was a problem hiding this comment.
Added an exact stderr assertion for the parser error in 66189c4, alongside the exit-code check. The integration tests pass locally.
| .arg("1a\x0bfoo") | ||
| .pipe_in("a\n") | ||
| .succeeds() | ||
| .stdout_is("a\n\x0bfoo\n"); |
There was a problem hiding this comment.
could you please add a case with a CRLF script read with -f? this is the one users will hit
There was a problem hiding this comment.
Added a CRLF script-file case using -f in 1cb3c48. It now treats CRLF as a script-file line ending without treating carriage return as a general script blank. I also fixed substitution endings (} and #); subst-options passes against the GNU testsuite locally. The 367 integration tests and 408 unit tests pass.
|
GNU sed testsuite comparison: |
Merging this PR will degrade performance by 3.86%2 warnings
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing |
Fixes #654.
Limit script blank skipping to space and tab. This prevents a trailing carriage return from being silently accepted after a command and preserves vertical tabs in one-line text.
Add unit coverage for other whitespace bytes and an integration regression for both behaviors.
Validation:
cargo test --quiet;cargo fmt --check;cargo clippy --all-targets -- -D warnings;git diff --check.