forked from astral-sh/ruff
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[red-knot] Improve mdtest output (astral-sh#14213)
- Loading branch information
1 parent
1388341
commit 813ec23
Showing
2 changed files
with
16 additions
and
15 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,24 +1,25 @@ | ||
use dir_test::{dir_test, Fixture}; | ||
use red_knot_test::run; | ||
use std::ffi::OsStr; | ||
use std::path::Path; | ||
|
||
use dir_test::{dir_test, Fixture}; | ||
|
||
/// See `crates/red_knot_test/README.md` for documentation on these tests. | ||
#[dir_test( | ||
dir: "$CARGO_MANIFEST_DIR/resources/mdtest", | ||
glob: "**/*.md" | ||
)] | ||
#[allow(clippy::needless_pass_by_value)] | ||
fn mdtest(fixture: Fixture<&str>) { | ||
let path = fixture.path(); | ||
let fixture_path = Path::new(fixture.path()); | ||
let crate_dir = Path::new(env!("CARGO_MANIFEST_DIR")); | ||
let workspace_root = crate_dir.parent().and_then(Path::parent).unwrap(); | ||
|
||
let crate_dir = Path::new(env!("CARGO_MANIFEST_DIR")) | ||
.join("resources/mdtest") | ||
.canonicalize() | ||
let long_title = fixture_path | ||
.strip_prefix(workspace_root) | ||
.unwrap() | ||
.to_str() | ||
.unwrap(); | ||
let short_title = fixture_path.file_name().and_then(OsStr::to_str).unwrap(); | ||
|
||
let relative_path = path | ||
.strip_prefix(crate_dir.to_str().unwrap()) | ||
.unwrap_or(path); | ||
|
||
run(Path::new(path), relative_path); | ||
red_knot_test::run(fixture_path, long_title, short_title); | ||
} |
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