]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc-ui/run-directory.rs
Rollup merge of #93840 - yaahc:termination-stabilization-celebration-station, r=josht...
[rust.git] / src / test / rustdoc-ui / run-directory.rs
1 // this test asserts that the cwd of doctest invocations is set correctly.
2
3 // revisions: correct incorrect
4 // check-pass
5 // [correct]compile-flags:--test --test-run-directory={{src-base}} -Zunstable-options
6 // [incorrect]compile-flags:--test --test-run-directory={{src-base}}/coverage -Zunstable-options
7 // normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
8 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
9
10 /// ```
11 /// assert_eq!(
12 ///     std::fs::read_to_string("run-directory.rs").unwrap(),
13 ///     include_str!("run-directory.rs"),
14 /// );
15 /// ```
16 #[cfg(correct)]
17 pub fn foo() {}
18
19 /// ```
20 /// assert!(std::fs::read_to_string("run-directory.rs").is_err());
21 /// ```
22 #[cfg(incorrect)]
23 pub fn foo() {}