2021-01-22 03:54:53 -06:00
|
|
|
// this test asserts that the cwd of doctest invocations is set correctly.
|
|
|
|
|
|
|
|
// revisions: correct incorrect
|
|
|
|
// check-pass
|
2022-10-28 04:43:30 -05:00
|
|
|
// [correct]compile-flags:--test --test-run-directory={{src-base}}
|
|
|
|
// [incorrect]compile-flags:--test --test-run-directory={{src-base}}/coverage
|
2023-04-29 04:08:33 -05:00
|
|
|
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
|
2021-01-22 03:54:53 -06:00
|
|
|
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
|
|
|
|
|
|
|
|
/// ```
|
|
|
|
/// assert_eq!(
|
2023-04-29 04:08:33 -05:00
|
|
|
/// std::fs::read_to_string("doctest/run-directory.rs").unwrap(),
|
2021-01-22 03:54:53 -06:00
|
|
|
/// include_str!("run-directory.rs"),
|
|
|
|
/// );
|
|
|
|
/// ```
|
|
|
|
#[cfg(correct)]
|
|
|
|
pub fn foo() {}
|
|
|
|
|
|
|
|
/// ```
|
2023-04-29 04:08:33 -05:00
|
|
|
/// assert!(std::fs::read_to_string("doctest/run-directory.rs").is_err());
|
2021-01-22 03:54:53 -06:00
|
|
|
/// ```
|
|
|
|
#[cfg(incorrect)]
|
|
|
|
pub fn foo() {}
|