Add cross-crate C-like variant test

This commit is contained in:
Guillaume Gomez 2023-10-07 14:37:47 +02:00
parent de70a77be2
commit b0badc17cd
2 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,24 @@
#![crate_name = "bar"]
pub enum E {
A = 12,
B,
C = 1245,
}
pub enum F {
A,
B,
}
#[repr(u32)]
pub enum G {
A = 12,
B,
C(u32),
}
pub enum H {
A,
C(u32),
}

View File

@ -1,8 +1,12 @@
// This test ensures that the variant value is displayed with underscores but without
// a type name at the end.
// aux-build:enum-variant.rs
#![crate_name = "foo"]
extern crate bar;
// 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.
@ -60,3 +64,35 @@ pub enum D {
A,
C(u32),
}
// @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;