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
@ -347,7 +346,7 @@ Module(
6 | 'format spec'}
7 |
8 | f'middle {'string':\\
| Syntax Error: f-string: unterminated string
| ^ Syntax Error: f-string: unterminated string
9 | 'format spec'}
|
@ -383,8 +382,8 @@ Module(
|
9 | 'format spec'}
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
@ -100,6 +99,6 @@ Module(
|
6 | pass
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
|