diff --git a/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_escaped_brackets.snap b/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_escaped_brackets.snap new file mode 100644 index 0000000..7e458fd --- /dev/null +++ b/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_escaped_brackets.snap @@ -0,0 +1,15 @@ +--- +source: parser/src/string.rs +expression: parse_ast +--- +[ + Constant( + ExprConstant { + range: 0..10, + value: Str( + "\\{x\\}", + ), + kind: None, + }, + ), +] diff --git a/parser/src/string.rs b/parser/src/string.rs index 3f5f1a2..750eaa7 100644 --- a/parser/src/string.rs +++ b/parser/src/string.rs @@ -960,6 +960,13 @@ mod tests { insta::assert_debug_snapshot!(parse_ast); } + #[test] + fn test_parse_fstring_escaped_brackets() { + let source = "\\{{x\\}}"; + let parse_ast = parse_fstring(source).unwrap(); + insta::assert_debug_snapshot!(parse_ast); + } + #[test] fn test_parse_string_concat() { let source = "'Hello ' 'world'";