From a0b403894971022c28a4544f144310b873489cf5 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 13 Dec 2024 16:20:00 +0100 Subject: [PATCH] Add ui regression test for #134221 --- .../doctest/comment-in-attr-134221.rs | 23 ++++++++++++ .../doctest/comment-in-attr-134221.stdout | 36 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 tests/rustdoc-ui/doctest/comment-in-attr-134221.rs create mode 100644 tests/rustdoc-ui/doctest/comment-in-attr-134221.stdout diff --git a/tests/rustdoc-ui/doctest/comment-in-attr-134221.rs b/tests/rustdoc-ui/doctest/comment-in-attr-134221.rs new file mode 100644 index 0000000000000..15a09eb788bc0 --- /dev/null +++ b/tests/rustdoc-ui/doctest/comment-in-attr-134221.rs @@ -0,0 +1,23 @@ +// Regression test for . +// It checks that even if there are comments in the attributes, the attributes +// will still be generated correctly (and therefore fail in this test). + +//@ compile-flags:--test --test-args --test-threads=1 +//@ failure-status: 101 +//@ normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ normalize-stdout-test: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL" + +/*! +```rust +#![feature( + foo, // +)] +``` + +```rust +#![feature( + foo, +)] +``` +*/ diff --git a/tests/rustdoc-ui/doctest/comment-in-attr-134221.stdout b/tests/rustdoc-ui/doctest/comment-in-attr-134221.stdout new file mode 100644 index 0000000000000..aa5a8262e858a --- /dev/null +++ b/tests/rustdoc-ui/doctest/comment-in-attr-134221.stdout @@ -0,0 +1,36 @@ + +running 2 tests +test $DIR/doctest/comment-in-attr-134221.rs - (line 11) ... FAILED +test $DIR/doctest/comment-in-attr-134221.rs - (line 17) ... FAILED + +failures: + +---- $DIR/doctest/comment-in-attr-134221.rs - (line 11) stdout ---- +error[E0635]: unknown feature `foo` + --> $DIR/doctest/comment-in-attr-134221.rs:$LINE:$COL + | +LL | foo, // + | ^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0635`. +Couldn't compile the test. +---- $DIR/doctest/comment-in-attr-134221.rs - (line 17) stdout ---- +error[E0635]: unknown feature `foo` + --> $DIR/doctest/comment-in-attr-134221.rs:$LINE:$COL + | +LL | foo, + | ^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0635`. +Couldn't compile the test. + +failures: + $DIR/doctest/comment-in-attr-134221.rs - (line 11) + $DIR/doctest/comment-in-attr-134221.rs - (line 17) + +test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME +