diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2023-11-02 18:01:28 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2023-11-02 18:02:14 +0100 |
| commit | 2e4a36bb530096537ce5a72d18c4b8dd4ea2a97b (patch) | |
| tree | d1d0e47e22c995487d7e6df95c0cb50499d38fc9 | |
| parent | aa9d1d87fa85971f9073f0f2cde531ea5819aa3a (diff) | |
| download | rust-2e4a36bb530096537ce5a72d18c4b8dd4ea2a97b.tar.gz rust-2e4a36bb530096537ce5a72d18c4b8dd4ea2a97b.zip | |
Add GUI test to ensure that implementations on foreign types are in the expected order
| -rw-r--r-- | tests/rustdoc-gui/impl_on_foreign_order.goml | 6 | ||||
| -rw-r--r-- | tests/rustdoc-gui/search-tab.goml | 2 | ||||
| -rw-r--r-- | tests/rustdoc-gui/src/test_docs/lib.rs | 19 |
3 files changed, 26 insertions, 1 deletions
diff --git a/tests/rustdoc-gui/impl_on_foreign_order.goml b/tests/rustdoc-gui/impl_on_foreign_order.goml new file mode 100644 index 00000000000..a6f5343beb2 --- /dev/null +++ b/tests/rustdoc-gui/impl_on_foreign_order.goml @@ -0,0 +1,6 @@ +// This test ensures that the "implementations on foreign types" of a trait are correctly sorted. +go-to: "file://" + |DOC_PATH| + "/test_docs/foreign_impl_order/trait.Foo.html" +assert-text: ("details:nth-of-type(1) h3", "impl Foo<1> for [u8; 1]") +assert-text: ("details:nth-of-type(2) h3", "impl Foo<2> for [u8; 2]") +assert-text: ("details:nth-of-type(3) h3", "impl Foo<3> for [u8; 3]") +assert-text: ("details:nth-of-type(4) h3", "impl Foo<4> for [u8; 4]") diff --git a/tests/rustdoc-gui/search-tab.goml b/tests/rustdoc-gui/search-tab.goml index 1c0c9e79e40..db1605ff220 100644 --- a/tests/rustdoc-gui/search-tab.goml +++ b/tests/rustdoc-gui/search-tab.goml @@ -79,7 +79,7 @@ call-function: ("check-colors", { set-window-size: (851, 600) // Check the size and count in tabs -assert-text: ("#search-tabs > button:nth-child(1) > .count", " (24) ") +assert-text: ("#search-tabs > button:nth-child(1) > .count", " (25) ") assert-text: ("#search-tabs > button:nth-child(2) > .count", " (5) ") assert-text: ("#search-tabs > button:nth-child(3) > .count", " (0) ") store-property: ("#search-tabs > button:nth-child(1)", {"offsetWidth": buttonWidth}) diff --git a/tests/rustdoc-gui/src/test_docs/lib.rs b/tests/rustdoc-gui/src/test_docs/lib.rs index 138a1b302fd..c7d115bdb98 100644 --- a/tests/rustdoc-gui/src/test_docs/lib.rs +++ b/tests/rustdoc-gui/src/test_docs/lib.rs @@ -574,3 +574,22 @@ impl ZyxwvutTrait for ZyxwvutMethodDisambiguation { x } } + +pub mod foreign_impl_order { + pub trait Foo<const W: usize> { + fn f(&mut self, with: [u8; W]); + } + + impl Foo<4> for [u8; 4] { + fn f(&mut self, fg: [u8; 4]) {} + } + impl Foo<2> for [u8; 2] { + fn f(&mut self, fg: [u8; 2]) {} + } + impl Foo<1> for [u8; 1] { + fn f(&mut self, fg: [u8; 1]) {} + } + impl Foo<3> for [u8; 3] { + fn f(&mut self, fg: [u8; 3]) {} + } +} |
