Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move most rustdoc-ui tests into subdirectories #110981

Merged
merged 2 commits into from
Apr 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// check-pass
// compile-flags:--test --test-args --test-threads=1
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"

// Crates like core have doctests gated on `cfg(not(test))` so we need to make
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// check-pass
// compile-flags: --test --nocapture --check-cfg=values(feature,"test") -Z unstable-options
// normalize-stderr-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stderr-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"

/// The doctest will produce a warning because feature invalid is unexpected
Expand Down
11 changes: 11 additions & 0 deletions tests/rustdoc-ui/doctest/check-cfg-test.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
warning: unexpected `cfg` condition value
--> $DIR/check-cfg-test.rs:9:7
|
LL | #[cfg(feature = "invalid")]
| ^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: test
= note: `#[warn(unexpected_cfgs)]` on by default

warning: 1 warning emitted

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// check-pass
// edition:2018
// compile-flags:--test --test-args=--show-output
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"

/// ```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Regression test for #97440: Multiline inner attribute triggers ICE during doctest
// compile-flags:--test
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
// check-pass

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// compile-flags:--test
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
// check-pass

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// check-pass
// compile-flags:--test
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"

// Make sure `cfg(doctest)` is set when finding doctests but not inside
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// check-pass
// compile-flags:--test
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"

#![feature(doc_cfg)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// compile-flags:--test --test-args=--test-threads=1
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
// check-pass

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// edition:2018
// aux-build:extern_macros.rs
// compile-flags:--test --test-args=--test-threads=1
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
// check-pass

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// adapted to use that, and that normalize line can go away

// compile-flags:--test
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
// failure-status: 101

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// adapted to use that, and that normalize line can go away

// compile-flags:--test
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
// failure-status: 101

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// adapted to use that, and that normalize line can go away

// compile-flags:--test
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
// failure-status: 101

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// compile-flags:--test --test-args --test-threads=1
// rustc-env:RUST_BACKTRACE=0
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
// failure-status: 101

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// compile-flags:--test --test-args --test-threads=1
// rustc-env:RUST_BACKTRACE=0
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
// failure-status: 101

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// adapted to use that, and that normalize line can go away

// compile-flags:--test
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
// failure-status: 101

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// check-pass
// compile-flags:-Z unstable-options --test --no-run --test-args=--test-threads=1
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"

/// ```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// check-pass
// compile-flags:--test -Zunstable-options --nocapture
// normalize-stderr-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stderr-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"

/// ```compile_fail
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// check-pass
// compile-flags:--test -Zunstable-options --nocapture
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"

/// ```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
// check-pass
// [correct]compile-flags:--test --test-run-directory={{src-base}}
// [incorrect]compile-flags:--test --test-run-directory={{src-base}}/coverage
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"

/// ```
/// assert_eq!(
/// std::fs::read_to_string("run-directory.rs").unwrap(),
/// std::fs::read_to_string("doctest/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());
/// assert!(std::fs::read_to_string("doctest/run-directory.rs").is_err());
/// ```
#[cfg(incorrect)]
pub fn foo() {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// compile-flags:--test
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
// check-pass

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// compile-flags: --test --test-args=--test-threads=1
// check-pass
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"

/// ```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// compile-flags: --test
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
// failure-status: 101
// rustc-env: RUST_BACKTRACE=0
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// check-pass
// compile-flags:--test
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/issues" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"

pub fn test() -> Result<(), ()> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// compile-flags:--test --error-format=short
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/issues" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
// failure-status: 101

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// compile-flags: --test --crate-name=empty_fn --extern=empty_fn --test-args=--test-threads=1
// aux-build:empty-fn.rs
// check-pass
// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/issues" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
// edition:2021

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.