about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2022-06-27 15:59:18 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2022-06-27 16:01:13 +0200
commit9277f959dda23b3a4129b28cc5b059788f6653af (patch)
treeccb012738edeb2b0493c39a0f84b797bf111e39a
parentc1c0d2593987a604fa0842ebd0b6515d9213883e (diff)
downloadrust-9277f959dda23b3a4129b28cc5b059788f6653af.tar.gz
rust-9277f959dda23b3a4129b28cc5b059788f6653af.zip
Add test for associated items in rustdoc JSON
-rw-r--r--src/test/rustdoc-json/assoc_items.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/rustdoc-json/assoc_items.rs b/src/test/rustdoc-json/assoc_items.rs
new file mode 100644
index 00000000000..2ee64c9f6eb
--- /dev/null
+++ b/src/test/rustdoc-json/assoc_items.rs
@@ -0,0 +1,29 @@
+#![no_std]
+
+// @has assoc_items.json
+
+pub struct Simple;
+
+impl Simple {
+    // @has - "$.index[*][?(@.name=='CONSTANT')].kind" \"assoc_const\"
+    pub const CONSTANT: usize = 0;
+}
+
+pub trait EasyToImpl {
+    // @has - "$.index[*][?(@.name=='ToDeclare')].kind" \"assoc_type\"
+    // @has - "$.index[*][?(@.name=='ToDeclare')].inner.default" null
+    type ToDeclare;
+    // @has - "$.index[*][?(@.name=='AN_ATTRIBUTE')].kind" \"assoc_const\"
+    // @has - "$.index[*][?(@.name=='AN_ATTRIBUTE')].inner.default" null
+    const AN_ATTRIBUTE: usize;
+}
+
+impl EasyToImpl for Simple {
+    // @has - "$.index[*][?(@.name=='ToDeclare')].inner.default.kind" \"primitive\"
+    // @has - "$.index[*][?(@.name=='ToDeclare')].inner.default.inner" \"usize\"
+    type ToDeclare = usize;
+    // @has - "$.index[*][?(@.name=='AN_ATTRIBUTE')].inner.type.kind" \"primitive\"
+    // @has - "$.index[*][?(@.name=='AN_ATTRIBUTE')].inner.type.inner" \"usize\"
+    // @has - "$.index[*][?(@.name=='AN_ATTRIBUTE')].inner.default" \"12\"
+    const AN_ATTRIBUTE: usize = 12;
+}