-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove escaped mac/windows eol from AST string value (#7724)
## Summary This PR fixes the bug where the value of a string node type includes the escaped mac/windows newline character. Note that the token value still includes them, it's only removed when parsing the string content. ## Test Plan Add new test cases for the string node type to check that the escapes aren't being included in the string value. fixes: #7723
- Loading branch information
1 parent
488ec54
commit e72d617
Showing
4 changed files
with
103 additions
and
1 deletion.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
...arser/src/snapshots/ruff_python_parser__string__tests__string_parser_escaped_mac_eol.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
source: crates/ruff_python_parser/src/string.rs | ||
expression: parse_ast | ||
--- | ||
[ | ||
Expr( | ||
StmtExpr { | ||
range: 0..18, | ||
value: Constant( | ||
ExprConstant { | ||
range: 0..18, | ||
value: Str( | ||
StringConstant { | ||
value: "text more text", | ||
unicode: false, | ||
implicit_concatenated: false, | ||
}, | ||
), | ||
}, | ||
), | ||
}, | ||
), | ||
] |
23 changes: 23 additions & 0 deletions
23
...rser/src/snapshots/ruff_python_parser__string__tests__string_parser_escaped_unix_eol.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
source: crates/ruff_python_parser/src/string.rs | ||
expression: parse_ast | ||
--- | ||
[ | ||
Expr( | ||
StmtExpr { | ||
range: 0..18, | ||
value: Constant( | ||
ExprConstant { | ||
range: 0..18, | ||
value: Str( | ||
StringConstant { | ||
value: "text more text", | ||
unicode: false, | ||
implicit_concatenated: false, | ||
}, | ||
), | ||
}, | ||
), | ||
}, | ||
), | ||
] |
23 changes: 23 additions & 0 deletions
23
...r/src/snapshots/ruff_python_parser__string__tests__string_parser_escaped_windows_eol.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
source: crates/ruff_python_parser/src/string.rs | ||
expression: parse_ast | ||
--- | ||
[ | ||
Expr( | ||
StmtExpr { | ||
range: 0..19, | ||
value: Constant( | ||
ExprConstant { | ||
range: 0..19, | ||
value: Str( | ||
StringConstant { | ||
value: "text more text", | ||
unicode: false, | ||
implicit_concatenated: false, | ||
}, | ||
), | ||
}, | ||
), | ||
}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters