summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc-ui/doctest/doc-test-doctest-feature.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rustdoc-ui/doctest/doc-test-doctest-feature.rs')
-rw-r--r--tests/rustdoc-ui/doctest/doc-test-doctest-feature.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/rustdoc-ui/doctest/doc-test-doctest-feature.rs b/tests/rustdoc-ui/doctest/doc-test-doctest-feature.rs
new file mode 100644
index 000000000..9c1f4936e
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/doc-test-doctest-feature.rs
@@ -0,0 +1,13 @@
+// check-pass
+// compile-flags:--test
+// 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
+// the doctests.
+
+/// ```
+/// assert!(!cfg!(doctest));
+/// ```
+#[cfg(doctest)]
+pub struct Foo;