-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
red_knot_test: add support for diagnostic snapshotting
This ties together everything from the previous commits. Some interesting bits here are how the snapshot is generated (where we include relevant info to make it easier to review the snapshots) and also a tweak to how inline assertions are processed. This commit also includes some example snapshots just to get a sense of what they look like. Follow-up work should add more of these I think.
- Loading branch information
1 parent
8d4679b
commit a84b27e
Showing
8 changed files
with
308 additions
and
18 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...mantic/resources/mdtest/snapshots/basic.md_-_Structures_-_Unresolvable_module_import.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
source: crates/red_knot_test/src/lib.rs | ||
expression: snapshot | ||
--- | ||
--- | ||
mdtest name: basic.md - Structures - Unresolvable module import | ||
mdtest path: crates/red_knot_python_semantic/resources/mdtest/import/basic.md | ||
--- | ||
|
||
# Python source files | ||
|
||
## mdtest_snippet__1.py | ||
|
||
``` | ||
1 | import zqzqzqzqzqzqzq # error: [unresolved-import] "Cannot resolve import `zqzqzqzqzqzqzq`" | ||
``` | ||
|
||
# Diagnostics | ||
|
||
``` | ||
error: lint:unresolved-import | ||
--> /src/mdtest_snippet__1.py:1:8 | ||
| | ||
1 | import zqzqzqzqzqzqzq # error: [unresolved-import] "Cannot resolve import `zqzqzqzqzqzqzq`" | ||
| ^^^^^^^^^^^^^^ Cannot resolve import `zqzqzqzqzqzqzq` | ||
| | ||
``` |
51 changes: 51 additions & 0 deletions
51
...ic/resources/mdtest/snapshots/basic.md_-_Structures_-_Unresolvable_submodule_imports.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
source: crates/red_knot_test/src/lib.rs | ||
expression: snapshot | ||
--- | ||
--- | ||
mdtest name: basic.md - Structures - Unresolvable submodule imports | ||
mdtest path: crates/red_knot_python_semantic/resources/mdtest/import/basic.md | ||
--- | ||
|
||
# Python source files | ||
|
||
## mdtest_snippet__1.py | ||
|
||
``` | ||
1 | # Topmost component resolvable, submodule not resolvable: | ||
2 | import a.foo # error: [unresolved-import] "Cannot resolve import `a.foo`" | ||
3 | | ||
4 | # Topmost component unresolvable: | ||
5 | import b.foo # error: [unresolved-import] "Cannot resolve import `b.foo`" | ||
``` | ||
|
||
## a/__init__.py | ||
|
||
``` | ||
``` | ||
|
||
# Diagnostics | ||
|
||
``` | ||
error: lint:unresolved-import | ||
--> /src/mdtest_snippet__1.py:2:8 | ||
| | ||
1 | # Topmost component resolvable, submodule not resolvable: | ||
2 | import a.foo # error: [unresolved-import] "Cannot resolve import `a.foo`" | ||
| ^^^^^ Cannot resolve import `a.foo` | ||
3 | | ||
4 | # Topmost component unresolvable: | ||
| | ||
``` | ||
|
||
``` | ||
error: lint:unresolved-import | ||
--> /src/mdtest_snippet__1.py:5:8 | ||
| | ||
4 | # Topmost component unresolvable: | ||
5 | import b.foo # error: [unresolved-import] "Cannot resolve import `b.foo`" | ||
| ^^^^^ Cannot resolve import `b.foo` | ||
| | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.