test: update snapshots with improper end-of-line placement

This looks like a bug fix that occurs when the annotation is a
zero-width span immediately following a line terminator. Previously, the
caret seems to be rendered on the next line, but it should be rendered
at the end of the line the span corresponds to.

I admit that this one is kinda weird. I would somewhat expect that our
spans here are actually incorrect, and that to obtain this sort of
rendering, we should identify a span just immediately _before_ the line
terminator and not after it. But I don't want to dive into that rabbit
hole for now (and given how `annotate-snippets` now renders these
spans, perhaps there is more to it than I see), and this does seem like
a clear improvement given the spans we feed to `annotate-snippets`.
This commit is contained in:
Andrew Gallant 2025-01-07 14:46:50 -05:00 committed by Andrew Gallant
parent f49cfb6c28
commit 5caef89af3
8 changed files with 29 additions and 35 deletions

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/inline/err/if_stmt_misspelled_elif.py
snapshot_kind: text
---
## AST
@ -90,8 +89,8 @@ Module(
|
3 | elf:
4 | pass
| ^ Syntax Error: Expected a statement
5 | else:
| Syntax Error: Expected a statement
6 | pass
|
@ -125,4 +124,5 @@ Module(
|
5 | else:
6 | pass
| ^ 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/match_stmt_expected_case_block.py
snapshot_kind: text
---
## AST
@ -113,8 +112,8 @@ Module(
|
1 | match x:
2 | x = 1
| ^ Syntax Error: Expected a statement
3 | match x:
| Syntax Error: Expected a statement
4 | match y:
5 | case _: ...
|
@ -132,4 +131,5 @@ Module(
|
4 | match y:
5 | case _: ...
| ^ 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/re_lex_logical_token_windows_eol.py
snapshot_kind: text
---
## AST
@ -100,9 +99,8 @@ Module(
## Errors
|
1 | if call(foo, [a, b
| ___________________^
2 | | def bar():
| |_^ Syntax Error: Expected ']', found NonLogicalNewline
3 | pass
1 | if call(foo, [a, b
| ^ Syntax Error: Expected ']', found NonLogicalNewline
2 | def bar():
3 | pass
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/re_lexing/line_continuation_windows_eol.py
snapshot_kind: text
---
## AST
@ -82,10 +81,9 @@ Module(
## Errors
|
1 | call(a, b, # comment \
| _______________________^
2 | |
| |_^ Syntax Error: Expected ')', found newline
3 | def bar():
4 | pass
1 | call(a, b, # comment \
| ^ Syntax Error: Expected ')', found newline
2 |
3 | def bar():
4 | pass
|