Repository navigation
Conversation
β¦ixes #1863) The default case in processEscapeSequences was dropping the backslash for unrecognised \X sequences like \". Now preserves the backslash, matching POSIX echo behavior.
|
No actionable comments were generated in the recent review. π βΉοΈ Recent review infoβοΈ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: π Files selected for processing (1)
π WalkthroughWalkthroughDefault handling in processEscapeSequences now appends a literal backslash before unrecognized escape characters. Three unit tests were added to verify preserved escaped quotes, multiple unrecognized escapes, and mixed recognized/unrecognized escapes. ChangesEcho backslash escape sequence fix
Estimated code review effortπ― 2 (Simple) | β±οΈ ~10 minutes Poem
π₯ Pre-merge checks | β 5β Passed checks (5 passed)
βοΈ Tip: You can configure your own custom pre-merge checks in the settings. β¨ Finishing Touchesπ Generate docstrings
π§ͺ Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
π§Ή Nitpick comments (1)
builtins/src/test/java/org/jline/builtins/PosixCommandsTest.java (1)
106-113: β‘ Quick winConsider adding tests for other unrecognized escape sequences.
While the current test validates the reported issue with
\", consider adding tests for other unrecognized escape sequences to ensure comprehensive coverage:π Suggested additional test cases
`@Test` void testEchoMultipleUnrecognizedEscapes() throws Exception { // Test multiple different unrecognized escapes PosixCommands.echo(context, new String[] {"echo", "\\x\\y\\z"}); String output = out.toString(); String expected = "\\x\\y\\z" + System.lineSeparator(); assertEquals(expected, output); } `@Test` void testEchoMixedRecognizedAndUnrecognizedEscapes() throws Exception { // Mix recognized (\n, \t) with unrecognized (\") PosixCommands.echo(context, new String[] {"echo", "line1\\nline2\\ttab\\\"quote"}); String output = out.toString(); String expected = "line1\nline2\ttab\\\"quote" + System.lineSeparator(); assertEquals(expected, output); }π€ Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@builtins/src/test/java/org/jline/builtins/PosixCommandsTest.java` around lines 106 - 113, Add two new unit tests in PosixCommandsTest to cover other unrecognized escape sequences: create testEchoMultipleUnrecognizedEscapes that calls PosixCommands.echo(context, new String[] {"echo", "\\x\\y\\z"}) and asserts output equals "\\x\\y\\z" + System.lineSeparator(), and create testEchoMixedRecognizedAndUnrecognizedEscapes that calls PosixCommands.echo(context, new String[] {"echo", "line1\\nline2\\ttab\\\"quote"}) and asserts output equals "line1\nline2\ttab\\\"quote" + System.lineSeparator(); ensure both tests use the same out capture used by existing tests and follow the same throws Exception signature as testEchoEscapeSequencePreservesBackslash.
π€ Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@builtins/src/test/java/org/jline/builtins/PosixCommandsTest.java`:
- Around line 106-113: Add two new unit tests in PosixCommandsTest to cover
other unrecognized escape sequences: create testEchoMultipleUnrecognizedEscapes
that calls PosixCommands.echo(context, new String[] {"echo", "\\x\\y\\z"}) and
asserts output equals "\\x\\y\\z" + System.lineSeparator(), and create
testEchoMixedRecognizedAndUnrecognizedEscapes that calls
PosixCommands.echo(context, new String[] {"echo",
"line1\\nline2\\ttab\\\"quote"}) and asserts output equals
"line1\nline2\ttab\\\"quote" + System.lineSeparator(); ensure both tests use the
same out capture used by existing tests and follow the same throws Exception
signature as testEchoEscapeSequencePreservesBackslash.
βΉοΈ Review info
βοΈ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a3c42549-d7da-4df3-b93e-b13823eba232
π Files selected for processing (2)
builtins/src/main/java/org/jline/builtins/PosixCommands.javabuiltins/src/test/java/org/jline/builtins/PosixCommandsTest.java
Cover additional edge cases for the backslash-preservation fix: consecutive unrecognized escapes (\x\y\z) and a mix of recognized (\n, \t) and unrecognized (\") escapes in the same string.
|
β¦1901) * fix: echo preserves backslash before unrecognised escape sequences (fixes #1863) The default case in processEscapeSequences was dropping the backslash for unrecognised \X sequences like \". Now preserves the backslash, matching POSIX echo behavior. * test: add tests for multiple and mixed unrecognized echo escapes Cover additional edge cases for the backslash-preservation fix: consecutive unrecognized escapes (\x\y\z) and a mix of recognized (\n, \t) and unrecognized (\") escapes in the same string.
β¦1901) * fix: echo preserves backslash before unrecognised escape sequences (fixes #1863) The default case in processEscapeSequences was dropping the backslash for unrecognised \X sequences like \". Now preserves the backslash, matching POSIX echo behavior. * test: add tests for multiple and mixed unrecognized echo escapes Cover additional edge cases for the backslash-preservation fix: consecutive unrecognized escapes (\x\y\z) and a mix of recognized (\n, \t) and unrecognized (\") escapes in the same string.
β¦1901) * fix: echo preserves backslash before unrecognised escape sequences (fixes #1863) The default case in processEscapeSequences was dropping the backslash for unrecognised \X sequences like \". Now preserves the backslash, matching POSIX echo behavior. * test: add tests for multiple and mixed unrecognized echo escapes Cover additional edge cases for the backslash-preservation fix: consecutive unrecognized escapes (\x\y\z) and a mix of recognized (\n, \t) and unrecognized (\") escapes in the same string.



Summary
processEscapeSequencesdefault case to preserve the backslash before unrecognised escape characters like\", matching POSIX echo behaviorFixes #1863
Test plan
testEchoEscapeSequencePreservesBackslashverifyingecho 'hello \"world\"'outputshello \"world\"instead ofhello "world"Summary by CodeRabbit