Skip to content

Commit

Permalink
Update enum-variant-value test
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Oct 6, 2023
1 parent aba776a commit 9d2e432
Showing 1 changed file with 49 additions and 2 deletions.
51 changes: 49 additions & 2 deletions tests/rustdoc/enum-variant-value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,60 @@

#![crate_name = "foo"]

// @has 'foo/enum.B.html'
// 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'
// @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 enum B {
pub enum A {
A = 12,
B,
C = 1245,
}

// 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),
}

0 comments on commit 9d2e432

Please sign in to comment.