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