Skip to content

Commit

Permalink
Add test case for variant transparency
Browse files Browse the repository at this point in the history
  • Loading branch information
tyranron committed Jul 25, 2024
1 parent 9690fe0 commit e570a25
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1324,13 +1324,19 @@ mod enums {
field: i32,
},
C,
#[display("{_0:b}")]
TransparentBinary(i32),
}

#[test]
fn assert() {
assert_eq!(Enum::A(1).to_string(), "A 1");
assert_eq!(Enum::B { field: 2 }.to_string(), "B 2");
assert_eq!(Enum::C.to_string(), "C");
assert_eq!(
format!("{:08}", Enum::TransparentBinary(4)),
"00000100",
);
}
}

Expand Down

0 comments on commit e570a25

Please sign in to comment.