Skip to content

Commit bb40417

Browse files
committed
add test fixtures
1 parent 8cf1b87 commit bb40417

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

crates/ruff_linter/resources/test/fixtures/ruff/RUF027_0.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,8 @@ def in_type_def():
7979
from typing import cast
8080
a = 'int'
8181
cast('f"{a}"','11')
82+
83+
# Regression test for parser bug
84+
# https://github.com/astral-sh/ruff/issues/18860
85+
def fuzz_bug():
86+
c('{\t"i}')

crates/ruff_python_parser/src/parser/tests.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,26 @@ foo.bar[0].baz[2].egg??
134134
.unwrap();
135135
insta::assert_debug_snapshot!(parsed.syntax());
136136
}
137+
138+
#[test]
139+
fn test_fstring_expr_inner_line_continuation_and_t_string() {
140+
let source = r#"f'{\t"i}'"#;
141+
142+
let parsed = parse_expression(source);
143+
144+
let error = parsed.unwrap_err();
145+
146+
insta::assert_debug_snapshot!(error);
147+
}
148+
149+
#[test]
150+
fn test_fstring_expr_inner_line_continuation_newline_t_string() {
151+
let source = r#"f'{\
152+
t"i}'"#;
153+
154+
let parsed = parse_expression(source);
155+
156+
let error = parsed.unwrap_err();
157+
158+
insta::assert_debug_snapshot!(error);
159+
}

0 commit comments

Comments
 (0)