about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlona Enraght-Moony <code@alona.page>2024-12-01 21:37:18 +0000
committerAlona Enraght-Moony <code@alona.page>2024-12-01 21:37:18 +0000
commit51ea7c12e70244dc89893888f3bfd6cead59d4c5 (patch)
tree13828bc3dabfc857887c81bc008c1343f7b2a48c
parent15b663e684d0acf1b4299b7ad6b4f4ab106395bd (diff)
downloadrust-51ea7c12e70244dc89893888f3bfd6cead59d4c5.tar.gz
rust-51ea7c12e70244dc89893888f3bfd6cead59d4c5.zip
rustdoc-json: Add tests for `static`s
-rw-r--r--tests/rustdoc-json/statics/statics.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/rustdoc-json/statics/statics.rs b/tests/rustdoc-json/statics/statics.rs
new file mode 100644
index 00000000000..e3ed9369925
--- /dev/null
+++ b/tests/rustdoc-json/statics/statics.rs
@@ -0,0 +1,10 @@
+//@ is '$.index[*][?(@.name=="A")].inner.static.type.primitive' '"i32"'
+//@ is '$.index[*][?(@.name=="A")].inner.static.is_mutable' false
+//@ is '$.index[*][?(@.name=="A")].inner.static.expr' '"5"'
+pub static A: i32 = 5;
+
+//@ is '$.index[*][?(@.name=="B")].inner.static.type.primitive' '"u32"'
+//@ is '$.index[*][?(@.name=="B")].inner.static.is_mutable' true
+// Expr value isn't gaurenteed, it'd be fine to change it.
+//@ is '$.index[*][?(@.name=="B")].inner.static.expr' '"_"'
+pub static mut B: u32 = 2 + 3;