2023-09-25 14:59:41 +02:00
|
|
|
// This test ensures that the variant value is displayed with underscores but without
|
|
|
|
// a type name at the end.
|
|
|
|
|
2023-10-07 14:37:47 +02:00
|
|
|
// aux-build:enum-variant.rs
|
|
|
|
|
2023-09-25 14:59:41 +02:00
|
|
|
#![crate_name = "foo"]
|
|
|
|
|
2023-10-07 14:37:47 +02:00
|
|
|
extern crate bar;
|
|
|
|
|
2023-10-07 00:25:34 +02:00
|
|
|
// In this case, since all variants are C-like variants and at least one of them
|
|
|
|
// has its value set, we display values for all of them.
|
|
|
|
|
|
|
|
// @has 'foo/enum.A.html'
|
2023-09-25 14:59:41 +02:00
|
|
|
// @has - '//*[@class="rust item-decl"]/code' 'A = 12,'
|
2023-10-07 00:25:34 +02:00
|
|
|
// @has - '//*[@class="rust item-decl"]/code' 'B = 13,'
|
2023-09-25 14:59:41 +02:00
|
|
|
// @has - '//*[@class="rust item-decl"]/code' 'C = 1_245,'
|
|
|
|
// @matches - '//*[@id="variant.A"]/h3' '^A = 12$'
|
2023-10-07 00:25:34 +02:00
|
|
|
// @matches - '//*[@id="variant.B"]/h3' '^B = 13$'
|
2023-09-25 14:59:41 +02:00
|
|
|
// @matches - '//*[@id="variant.C"]/h3' '^C = 1_245$'
|
2023-10-07 00:25:34 +02:00
|
|
|
pub enum A {
|
2023-09-25 14:59:41 +02:00
|
|
|
A = 12,
|
|
|
|
B,
|
|
|
|
C = 1245,
|
|
|
|
}
|
2023-10-07 00:25:34 +02:00
|
|
|
|
|
|
|
// In this case, all variants are C-like variants but none of them has its value set.
|
|
|
|
// Therefore we don't display values.
|
|
|
|
|
|
|
|
// @has 'foo/enum.B.html'
|
|
|
|
// @has - '//*[@class="rust item-decl"]/code' 'A,'
|
|
|
|
// @has - '//*[@class="rust item-decl"]/code' 'B,'
|
|
|
|
// @matches - '//*[@id="variant.A"]/h3' '^A$'
|
|
|
|
// @matches - '//*[@id="variant.B"]/h3' '^B$'
|
|
|
|
pub enum B {
|
|
|
|
A,
|
|
|
|
B,
|
|
|
|
}
|
|
|
|
|
|
|
|
// In this case, not all variants are C-like variants so we don't display values.
|
|
|
|
|
|
|
|
// @has 'foo/enum.C.html'
|
|
|
|
// @has - '//*[@class="rust item-decl"]/code' 'A = 12,'
|
|
|
|
// @has - '//*[@class="rust item-decl"]/code' 'B,'
|
|
|
|
// @has - '//*[@class="rust item-decl"]/code' 'C(u32),'
|
|
|
|
// @matches - '//*[@id="variant.A"]/h3' '^A = 12$'
|
|
|
|
// @matches - '//*[@id="variant.B"]/h3' '^B$'
|
|
|
|
// @has - '//*[@id="variant.C"]/h3' 'C(u32)'
|
|
|
|
#[repr(u32)]
|
|
|
|
pub enum C {
|
|
|
|
A = 12,
|
|
|
|
B,
|
|
|
|
C(u32),
|
|
|
|
}
|
|
|
|
|
|
|
|
// In this case, not all variants are C-like variants and no C-like variant has its
|
|
|
|
// value set, so we don't display values.
|
|
|
|
|
|
|
|
// @has 'foo/enum.D.html'
|
|
|
|
// @has - '//*[@class="rust item-decl"]/code' 'A,'
|
|
|
|
// @has - '//*[@class="rust item-decl"]/code' 'C(u32),'
|
|
|
|
// @matches - '//*[@id="variant.A"]/h3' '^A$'
|
|
|
|
// @has - '//*[@id="variant.C"]/h3' 'C(u32)'
|
|
|
|
pub enum D {
|
|
|
|
A,
|
|
|
|
C(u32),
|
|
|
|
}
|
2023-10-07 14:37:47 +02:00
|
|
|
|
|
|
|
// @has 'foo/enum.E.html'
|
|
|
|
// @has - '//*[@class="rust item-decl"]/code' 'A = 12,'
|
|
|
|
// @has - '//*[@class="rust item-decl"]/code' 'B = 13,'
|
|
|
|
// @has - '//*[@class="rust item-decl"]/code' 'C = 1_245,'
|
|
|
|
// @matches - '//*[@id="variant.A"]/h3' '^A = 12$'
|
|
|
|
// @matches - '//*[@id="variant.B"]/h3' '^B = 13$'
|
|
|
|
// @matches - '//*[@id="variant.C"]/h3' '^C = 1_245$'
|
|
|
|
pub use bar::E;
|
|
|
|
|
|
|
|
// @has 'foo/enum.F.html'
|
|
|
|
// @has - '//*[@class="rust item-decl"]/code' 'A,'
|
|
|
|
// @has - '//*[@class="rust item-decl"]/code' 'B,'
|
|
|
|
// @matches - '//*[@id="variant.A"]/h3' '^A$'
|
|
|
|
// @matches - '//*[@id="variant.B"]/h3' '^B$'
|
|
|
|
pub use bar::F;
|
|
|
|
|
|
|
|
// @has 'foo/enum.G.html'
|
|
|
|
// @has - '//*[@class="rust item-decl"]/code' 'A = 12,'
|
|
|
|
// @has - '//*[@class="rust item-decl"]/code' 'B,'
|
|
|
|
// @has - '//*[@class="rust item-decl"]/code' 'C(u32),'
|
|
|
|
// @matches - '//*[@id="variant.A"]/h3' '^A = 12$'
|
|
|
|
// @matches - '//*[@id="variant.B"]/h3' '^B$'
|
|
|
|
// @has - '//*[@id="variant.C"]/h3' 'C(u32)'
|
|
|
|
pub use bar::G;
|
|
|
|
|
|
|
|
// @has 'foo/enum.H.html'
|
|
|
|
// @has - '//*[@class="rust item-decl"]/code' 'A,'
|
|
|
|
// @has - '//*[@class="rust item-decl"]/code' 'C(u32),'
|
|
|
|
// @matches - '//*[@id="variant.A"]/h3' '^A$'
|
|
|
|
// @has - '//*[@id="variant.C"]/h3' 'C(u32)'
|
|
|
|
pub use bar::H;
|