]> git.lizzy.rs Git - rust.git/commitdiff
rustdoc: add test case for associated type margins
authorMichael Howell <michael@notriddle.com>
Mon, 31 Oct 2022 14:47:42 +0000 (07:47 -0700)
committerMichael Howell <michael@notriddle.com>
Mon, 31 Oct 2022 14:47:42 +0000 (07:47 -0700)
src/test/rustdoc-gui/method-margins.goml [new file with mode: 0644]
src/test/rustdoc-gui/src/test_docs/lib.rs

diff --git a/src/test/rustdoc-gui/method-margins.goml b/src/test/rustdoc-gui/method-margins.goml
new file mode 100644 (file)
index 0000000..397bcd4
--- /dev/null
@@ -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"]
+)
index fdf97e492aa2babfa90a77af89e0e9203e864c86..8eea5ad01c02dd68d0a37893a49c0503bc277d3f 100644 (file)
@@ -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() {}
+    }
+}