diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-11-29 05:24:25 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-29 05:24:25 +0100 |
| commit | f6e544836120bc4edacad177e0e161cedac20b17 (patch) | |
| tree | a258f96cef4f06de1af2fc50b790e320c202b6f4 /src/test | |
| parent | 0e7f15947e8427ff75edd8658d74ceeb1cd7d6d6 (diff) | |
| parent | d958f3773ad04410b9fa316c2c7e242963e51ac5 (diff) | |
| download | rust-f6e544836120bc4edacad177e0e161cedac20b17.tar.gz rust-f6e544836120bc4edacad177e0e161cedac20b17.zip | |
Rollup merge of #105027 - aDotInTheVoid:rdj-foreign-variant-test, r=GuillaumeGomez
Rustdoc-Json: Add tests for linking to foreign variants. I initially taught these would be bugs, but it turn out they work perfectly, and the variant is added to paths. Most of the work is done by jsondoclint checking all the ID's resolve (although this wont happen for links until #105015, which in turn is blocked on removing foreign traits), but we do check that neither the enum nor the variant is inlined, so it must be resolved correctly through paths. r? ``@GuillaumeGomez``
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/rustdoc-json/enums/auxiliary/color.rs | 5 | ||||
| -rw-r--r-- | src/test/rustdoc-json/enums/doc_link_to_foreign_variant.rs | 11 | ||||
| -rw-r--r-- | src/test/rustdoc-json/enums/use_variant_foreign.rs | 9 |
3 files changed, 25 insertions, 0 deletions
diff --git a/src/test/rustdoc-json/enums/auxiliary/color.rs b/src/test/rustdoc-json/enums/auxiliary/color.rs new file mode 100644 index 00000000000..7188f793832 --- /dev/null +++ b/src/test/rustdoc-json/enums/auxiliary/color.rs @@ -0,0 +1,5 @@ +pub enum Color { + Red, + Green, + Blue, +} diff --git a/src/test/rustdoc-json/enums/doc_link_to_foreign_variant.rs b/src/test/rustdoc-json/enums/doc_link_to_foreign_variant.rs new file mode 100644 index 00000000000..470b195a292 --- /dev/null +++ b/src/test/rustdoc-json/enums/doc_link_to_foreign_variant.rs @@ -0,0 +1,11 @@ +// aux-build: color.rs + +//! The purpose of this test it to have a link to [a foreign variant](Red). + +extern crate color; +use color::Color::Red; + +// @set red = "$.index[*][?(@.inner.is_crate == true)].links.Red" + +// @!has "$.index[*][?(@.name == 'Red')]" +// @!has "$.index[*][?(@.name == 'Color')]" diff --git a/src/test/rustdoc-json/enums/use_variant_foreign.rs b/src/test/rustdoc-json/enums/use_variant_foreign.rs new file mode 100644 index 00000000000..11bb6ce1f3a --- /dev/null +++ b/src/test/rustdoc-json/enums/use_variant_foreign.rs @@ -0,0 +1,9 @@ +// aux-build: color.rs + +extern crate color; + +// @is "$.index[*][?(@.inner.name == 'Red')].kind" '"import"' +pub use color::Color::Red; + +// @!has "$.index[*][?(@.name == 'Red')]" +// @!has "$.index[*][?(@.name == 'Color')]" |
