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
This commit is contained in:
@@ -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,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
]
|
||||
@@ -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,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
]
|
||||
@@ -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,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user