about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2022-10-31 07:47:42 -0700
committerMichael Howell <michael@notriddle.com>2022-10-31 07:47:42 -0700
commit492ee6ae053b48f00f0a98bfa95a5adacd33c297 (patch)
treebc2074dddc2bd3cc7d87f3f9d8238c6571f59411
parent791f04e5a47ee78951552c7ed1545b2b01a44c74 (diff)
downloadrust-492ee6ae053b48f00f0a98bfa95a5adacd33c297.tar.gz
rust-492ee6ae053b48f00f0a98bfa95a5adacd33c297.zip
rustdoc: add test case for associated type margins
-rw-r--r--src/test/rustdoc-gui/method-margins.goml17
-rw-r--r--src/test/rustdoc-gui/src/test_docs/lib.rs17
2 files changed, 34 insertions, 0 deletions
diff --git a/src/test/rustdoc-gui/method-margins.goml b/src/test/rustdoc-gui/method-margins.goml
new file mode 100644
index 00000000000..397bcd40b36
--- /dev/null
+++ b/src/test/rustdoc-gui/method-margins.goml
@@ -0,0 +1,17 @@
+goto: "file://" + |DOC_PATH| + "/test_docs/trait_members/struct.HasTrait.html#impl-TraitMembers-for-HasTrait"
+
+assert-count: ("#trait-implementations-list > .rustdoc-toggle", 1)
+
+compare-elements-css: (
+    // compare margin on type with margin on method
+    "#trait-implementations-list .impl-items > .rustdoc-toggle:nth-child(1) > summary",
+    "#trait-implementations-list .impl-items > .rustdoc-toggle:nth-child(2) > summary",
+    ["margin"]
+)
+
+compare-elements-css: (
+    // compare margin on type with margin on method
+    "#trait-implementations-list .impl-items > .rustdoc-toggle:nth-child(1)",
+    "#trait-implementations-list .impl-items > .rustdoc-toggle:nth-child(2)",
+    ["margin"]
+)
diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs
index fdf97e492aa..8eea5ad01c0 100644
--- a/src/test/rustdoc-gui/src/test_docs/lib.rs
+++ b/src/test/rustdoc-gui/src/test_docs/lib.rs
@@ -416,3 +416,20 @@ pub trait TraitWithoutGenerics {
 
     fn foo();
 }
+
+pub mod trait_members {
+    pub trait TraitMembers {
+        /// Some type
+        type Type;
+        /// Some function
+        fn function();
+        /// Some other function
+        fn function2();
+    }
+    pub struct HasTrait;
+    impl TraitMembers for HasTrait {
+        type Type = u8;
+        fn function() {}
+        fn function2() {}
+    }
+}