about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2023-09-25 14:59:41 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2023-09-25 15:01:14 +0200
commit4a64c796ee4d243566beff014016e12c165ef534 (patch)
treeeadd5c658a1559a5190624eb653d9bb042311163
parenta576dfd0c63508b7424dc1b59ad7f6b154341730 (diff)
downloadrust-4a64c796ee4d243566beff014016e12c165ef534.tar.gz
rust-4a64c796ee4d243566beff014016e12c165ef534.zip
Add test for enum variant value display
-rw-r--r--tests/rustdoc/enum-variant-value.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/rustdoc/enum-variant-value.rs b/tests/rustdoc/enum-variant-value.rs
new file mode 100644
index 00000000000..09956b8c866
--- /dev/null
+++ b/tests/rustdoc/enum-variant-value.rs
@@ -0,0 +1,15 @@
+// This test ensures that the variant value is displayed with underscores but without
+// a type name at the end.
+
+#![crate_name = "foo"]
+
+// @has 'foo/enum.B.html'
+// @has - '//*[@class="rust item-decl"]/code' 'A = 12,'
+// @has - '//*[@class="rust item-decl"]/code' 'C = 1_245,'
+// @matches - '//*[@id="variant.A"]/h3' '^A = 12$'
+// @matches - '//*[@id="variant.C"]/h3' '^C = 1_245$'
+pub enum B {
+    A = 12,
+    B,
+    C = 1245,
+}