-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #81264 - Swatinem:doctest-run-directory, r=jyn514
Add unstable option to control doctest run directory This option will allow splitting the compile-time from the run-time directory of doctest invocations and is one step to solve rust-lang/cargo#8993 (comment) r? `@jyn514`
- Loading branch information
Showing
6 changed files
with
51 additions
and
0 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
running 1 test | ||
test $DIR/run-directory.rs - foo (line 10) ... ok | ||
|
||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME | ||
|
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,6 @@ | ||
|
||
running 1 test | ||
test $DIR/run-directory.rs - foo (line 19) ... ok | ||
|
||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME | ||
|
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,23 @@ | ||
// this test asserts that the cwd of doctest invocations is set correctly. | ||
|
||
// revisions: correct incorrect | ||
// check-pass | ||
// [correct]compile-flags:--test --test-run-directory={{src-base}} | ||
// [incorrect]compile-flags:--test --test-run-directory={{src-base}}/coverage | ||
// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR" | ||
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" | ||
|
||
/// ``` | ||
/// assert_eq!( | ||
/// std::fs::read_to_string("run-directory.rs").unwrap(), | ||
/// include_str!("run-directory.rs"), | ||
/// ); | ||
/// ``` | ||
#[cfg(correct)] | ||
pub fn foo() {} | ||
|
||
/// ``` | ||
/// assert!(std::fs::read_to_string("run-directory.rs").is_err()); | ||
/// ``` | ||
#[cfg(incorrect)] | ||
pub fn foo() {} |