From e570a258c8c06aa1cf6ff9744fb6e33c3f17dd5a Mon Sep 17 00:00:00 2001 From: tyranron Date: Thu, 25 Jul 2024 13:10:17 +0300 Subject: [PATCH] Add test case for variant transparency --- tests/display.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/display.rs b/tests/display.rs index 93cbc33e..2e3f0620 100644 --- a/tests/display.rs +++ b/tests/display.rs @@ -1324,6 +1324,8 @@ mod enums { field: i32, }, C, + #[display("{_0:b}")] + TransparentBinary(i32), } #[test] @@ -1331,6 +1333,10 @@ mod enums { 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", + ); } }