From 0eff07ee4ec22e7f83462b4b1a42dc04e9d5570b Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 4 Nov 2024 14:46:04 +0100 Subject: [PATCH] Add UI regressions tests for rustdoc `--show-coverage` option --- tests/rustdoc-ui/show-coverage-json.rs | 13 +++++++++++++ tests/rustdoc-ui/show-coverage-json.stdout | 1 + tests/rustdoc-ui/show-coverage.rs | 13 +++++++++++++ tests/rustdoc-ui/show-coverage.stdout | 7 +++++++ 4 files changed, 34 insertions(+) create mode 100644 tests/rustdoc-ui/show-coverage-json.rs create mode 100644 tests/rustdoc-ui/show-coverage-json.stdout create mode 100644 tests/rustdoc-ui/show-coverage.rs create mode 100644 tests/rustdoc-ui/show-coverage.stdout diff --git a/tests/rustdoc-ui/show-coverage-json.rs b/tests/rustdoc-ui/show-coverage-json.rs new file mode 100644 index 00000000000..3851e34fe35 --- /dev/null +++ b/tests/rustdoc-ui/show-coverage-json.rs @@ -0,0 +1,13 @@ +//@ compile-flags: -Z unstable-options --show-coverage --output-format=json +//@ check-pass + +mod bar { + /// a + /// + /// ``` + /// let x = 0; + /// ``` + pub struct Foo; +} + +pub use bar::Foo; diff --git a/tests/rustdoc-ui/show-coverage-json.stdout b/tests/rustdoc-ui/show-coverage-json.stdout new file mode 100644 index 00000000000..ed5b5a60212 --- /dev/null +++ b/tests/rustdoc-ui/show-coverage-json.stdout @@ -0,0 +1 @@ +{"$DIR/show-coverage-json.rs":{"total":2,"with_docs":1,"total_examples":2,"with_examples":1}} diff --git a/tests/rustdoc-ui/show-coverage.rs b/tests/rustdoc-ui/show-coverage.rs new file mode 100644 index 00000000000..00bb1606a82 --- /dev/null +++ b/tests/rustdoc-ui/show-coverage.rs @@ -0,0 +1,13 @@ +//@ compile-flags: -Z unstable-options --show-coverage +//@ check-pass + +mod bar { + /// a + /// + /// ``` + /// let x = 0; + /// ``` + pub struct Foo; +} + +pub use bar::Foo; diff --git a/tests/rustdoc-ui/show-coverage.stdout b/tests/rustdoc-ui/show-coverage.stdout new file mode 100644 index 00000000000..b3b7679771f --- /dev/null +++ b/tests/rustdoc-ui/show-coverage.stdout @@ -0,0 +1,7 @@ ++-------------------------------------+------------+------------+------------+------------+ +| File | Documented | Percentage | Examples | Percentage | ++-------------------------------------+------------+------------+------------+------------+ +| ...ests/rustdoc-ui/show-coverage.rs | 1 | 50.0% | 1 | 50.0% | ++-------------------------------------+------------+------------+------------+------------+ +| Total | 1 | 50.0% | 1 | 50.0% | ++-------------------------------------+------------+------------+------------+------------+