diff options
| author | bors <bors@rust-lang.org> | 2021-05-01 15:36:23 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-05-01 15:36:23 +0000 |
| commit | 5f304a5d7908d9dd55dda3baadd3cf564d907369 (patch) | |
| tree | 12ab8af58bb825bf6ab44246a1d1ab063a449dcc /src/test | |
| parent | 603a42ec5458c547b51173cfa48c23ad37b03c3f (diff) | |
| parent | 03c710bf8923057ae2050f4300527ff922a2f081 (diff) | |
| download | rust-5f304a5d7908d9dd55dda3baadd3cf564d907369.tar.gz rust-5f304a5d7908d9dd55dda3baadd3cf564d907369.zip | |
Auto merge of #83857 - ABouttefeux:master, r=jyn514
added --no-run option for rustdoc resolve #59053 add `--no-run` option for `rustdoc` for compiling doc test but not running them. Intended for use with `--persist-doctests`.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/rustdoc-ui/no-run-flag-error.rs | 6 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/no-run-flag-error.stderr | 2 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/no-run-flag.rs | 38 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/no-run-flag.stdout | 12 |
4 files changed, 58 insertions, 0 deletions
diff --git a/src/test/rustdoc-ui/no-run-flag-error.rs b/src/test/rustdoc-ui/no-run-flag-error.rs new file mode 100644 index 00000000000..4ead621482b --- /dev/null +++ b/src/test/rustdoc-ui/no-run-flag-error.rs @@ -0,0 +1,6 @@ +// test the behavior of the --no-run flag without the --test flag + +// compile-flags:-Z unstable-options --no-run --test-args=--test-threads=1 +// error-pattern: the `--test` flag must be passed + +pub fn f() {} diff --git a/src/test/rustdoc-ui/no-run-flag-error.stderr b/src/test/rustdoc-ui/no-run-flag-error.stderr new file mode 100644 index 00000000000..d032646c365 --- /dev/null +++ b/src/test/rustdoc-ui/no-run-flag-error.stderr @@ -0,0 +1,2 @@ +error: the `--test` flag must be passed to enable `--no-run` + diff --git a/src/test/rustdoc-ui/no-run-flag.rs b/src/test/rustdoc-ui/no-run-flag.rs new file mode 100644 index 00000000000..da1672c4a6e --- /dev/null +++ b/src/test/rustdoc-ui/no-run-flag.rs @@ -0,0 +1,38 @@ +// test the behavior of the --no-run flag + +// check-pass +// compile-flags:-Z unstable-options --test --no-run --test-args=--test-threads=1 +// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" + +/// ``` +/// let a = true; +/// ``` +/// ```should_panic +/// panic!() +/// ``` +/// ```ignore (incomplete-code) +/// fn foo() { +/// ``` +/// ```no_run +/// loop { +/// println!("Hello, world"); +/// } +/// ``` +/// fails to compile +/// ```compile_fail +/// let x = 5; +/// x += 2; // shouldn't compile! +/// ``` +/// Ok the test does not run +/// ``` +/// panic!() +/// ``` +/// Ok the test does not run +/// ```should_panic +/// loop { +/// println!("Hello, world"); +/// panic!() +/// } +/// ``` +pub fn f() {} diff --git a/src/test/rustdoc-ui/no-run-flag.stdout b/src/test/rustdoc-ui/no-run-flag.stdout new file mode 100644 index 00000000000..d92f5da8335 --- /dev/null +++ b/src/test/rustdoc-ui/no-run-flag.stdout @@ -0,0 +1,12 @@ + +running 7 tests +test $DIR/no-run-flag.rs - f (line 11) ... ok +test $DIR/no-run-flag.rs - f (line 14) ... ignored +test $DIR/no-run-flag.rs - f (line 17) ... ok +test $DIR/no-run-flag.rs - f (line 23) ... ok +test $DIR/no-run-flag.rs - f (line 28) ... ok +test $DIR/no-run-flag.rs - f (line 32) ... ok +test $DIR/no-run-flag.rs - f (line 8) ... ok + +test result: ok. 6 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME + |
