diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2019-04-24 22:26:42 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2019-04-24 22:26:42 +0200 |
| commit | 459d677bfffa0adeef75218d1cfa5f686e413f4d (patch) | |
| tree | a360f215003db166a90fbb3616323191ea656823 | |
| parent | 8ed2292dbe75b9b65e9fe1a079428d1e1e3b610f (diff) | |
| download | rust-459d677bfffa0adeef75218d1cfa5f686e413f4d.tar.gz rust-459d677bfffa0adeef75218d1cfa5f686e413f4d.zip | |
Add test for rustdoc cfg(test) feature
| -rw-r--r-- | src/test/rustdoc-ui/cfg-test.rs | 19 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/cfg-test.stdout | 6 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/test/rustdoc-ui/cfg-test.rs b/src/test/rustdoc-ui/cfg-test.rs new file mode 100644 index 00000000000..e26034371f4 --- /dev/null +++ b/src/test/rustdoc-ui/cfg-test.rs @@ -0,0 +1,19 @@ +// compile-pass +// compile-flags:--test +// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR" + +/// this doctest will be ignored: +/// +/// ``` +/// assert!(false); +/// ``` +#[cfg(not(test))] +pub struct Foo; + +/// this doctest will be tested: +/// +/// ``` +/// assert!(true); +/// ``` +#[cfg(test)] +pub struct Foo; diff --git a/src/test/rustdoc-ui/cfg-test.stdout b/src/test/rustdoc-ui/cfg-test.stdout new file mode 100644 index 00000000000..30bb0038d1b --- /dev/null +++ b/src/test/rustdoc-ui/cfg-test.stdout @@ -0,0 +1,6 @@ + +running 1 test +test $DIR/cfg-test.rs - Foo (line 15) ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out + |
