]> git.lizzy.rs Git - rust.git/blob - tests/rustdoc-ui/run-directory.rs
Rollup merge of #107770 - notriddle:notriddle/br2nl, r=GuillaumeGomez
[rust.git] / tests / 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: "tests/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() {}