test: add more missing carets

This update includes some missing `^` in the diagnostic annotations.

This update also includes some shifting of "syntax error" annotations to
the end of the preceding line. I believe this is technically a
regression, but fixing them has proven quite difficult. I *think* the
best way to do that might be to tweak the spans generated by the Python
parser errors, but I didn't want to dig into that. (Another approach
would be to change the `annotate-snippets` rendering, but when I tried
that and managed to fix these regressions, I ended up causing a bunch of
other regressions.)

Ref 77d454525e (r1915458616)
This commit is contained in:
Andrew Gallant 2025-01-14 14:05:45 -05:00 committed by Andrew Gallant
parent 5021f32449
commit 17f01a4355
3 changed files with 19 additions and 22 deletions

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/re_lexing/fstring_format_spec_1.py
snapshot_kind: text
---
## AST
@ -301,7 +300,7 @@ Module(
5 | f'middle {'string':\
6 | 'format spec'}
| ^ Syntax Error: f-string: expecting '}'
7 |
7 |
8 | f'middle {'string':\\
|
@ -310,7 +309,7 @@ Module(
5 | f'middle {'string':\
6 | 'format spec'}
| ^^^^^^ Syntax Error: Simple statements must be separated by newlines or semicolons
7 |
7 |
8 | f'middle {'string':\\
|
@ -319,7 +318,7 @@ Module(
5 | f'middle {'string':\
6 | 'format spec'}
| ^^^^ Syntax Error: Simple statements must be separated by newlines or semicolons
7 |
7 |
8 | f'middle {'string':\\
|
@ -328,7 +327,7 @@ Module(
5 | f'middle {'string':\
6 | 'format spec'}
| ^^ Syntax Error: missing closing quote in string literal
7 |
7 |
8 | f'middle {'string':\\
|
@ -337,7 +336,7 @@ Module(
5 | f'middle {'string':\
6 | 'format spec'}
| ^ Syntax Error: Expected a statement
7 |
7 |
8 | f'middle {'string':\\
9 | 'format spec'}
|
@ -345,9 +344,9 @@ Module(
|
6 | 'format spec'}
7 |
7 |
8 | f'middle {'string':\\
| Syntax Error: f-string: unterminated string
| ^ Syntax Error: f-string: unterminated string
9 | 'format spec'}
|
@ -356,7 +355,7 @@ Module(
8 | f'middle {'string':\\
9 | 'format spec'}
| ^^^^^^^^ Syntax Error: Unexpected indentation
10 |
10 |
11 | f'middle {'string':\\\
|
@ -365,7 +364,7 @@ Module(
8 | f'middle {'string':\\
9 | 'format spec'}
| ^ Syntax Error: Expected a statement
10 |
10 |
11 | f'middle {'string':\\\
|
@ -374,7 +373,7 @@ Module(
8 | f'middle {'string':\\
9 | 'format spec'}
| ^ Syntax Error: Expected a statement
10 |
10 |
11 | f'middle {'string':\\\
12 | 'format spec'}
|
@ -382,9 +381,9 @@ Module(
|
9 | 'format spec'}
10 |
10 |
| ^ Syntax Error: Expected a statement
11 | f'middle {'string':\\\
| Syntax Error: Expected a statement
12 | 'format spec'}
|
@ -420,5 +419,5 @@ Module(
|
11 | f'middle {'string':\\\
12 | 'format spec'}
| Syntax Error: Expected a statement
| ^ Syntax Error: Expected a statement
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/statements/if_extra_indent.py
snapshot_kind: text
---
## AST
@ -92,14 +91,14 @@ Module(
3 | pass
4 | a + b
| ^^^^^^^^ Syntax Error: Unexpected indentation
5 |
5 |
6 | pass
|
|
6 | pass
7 |
7 |
| ^ Syntax Error: Expected a statement
8 | a = 10
| Syntax Error: Expected a statement
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/inline/err/try_stmt_misspelled_except.py
snapshot_kind: text
---
## AST
@ -198,8 +197,8 @@ Module(
|
3 | exept: # spellchecker:disable-line
4 | pass
| ^ Syntax Error: Expected a statement
5 | finally:
| Syntax Error: Expected a statement
6 | pass
7 | a = 1
|
@ -239,8 +238,8 @@ Module(
|
5 | finally:
6 | pass
| ^ Syntax Error: Expected a statement
7 | a = 1
| Syntax Error: Expected a statement
8 | try:
9 | pass
|
@ -268,6 +267,6 @@ Module(
|
12 | exept: # spellchecker:disable-line
13 | pass
| ^ Syntax Error: Expected a statement
14 | b = 1
| Syntax Error: Expected a statement
|