Skip to content

Commit 35dcd82

Browse files
xNxExOxmeithecatte
authored andcommitted
Add a test for custom defaults
1 parent d09a8cf commit 35dcd82

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test_suite/common.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ enum Test1 {
1919
E = 1 << 34,
2020
}
2121

22+
#[enumflags2::bitflags(default = B | C)]
23+
#[derive(Copy, Clone, Debug)]
24+
#[repr(u8)]
25+
enum Default6 {
26+
A = 1 << 0,
27+
B = 1 << 1,
28+
C = 1 << 2,
29+
D = 1 << 3,
30+
}
31+
2232
#[test]
2333
fn test_foo() {
2434
use enumflags2::BitFlags;
@@ -60,6 +70,8 @@ fn test_foo() {
6070
assert_eq!(b, Test::A | Test::C);
6171
}
6272
assert_eq!((Test::A ^ Test::B), Test::A | Test::B);
73+
74+
assert_eq!(BitFlags::<Default6>::default(), Default6::B | Default6::C);
6375
}
6476

6577
#[test]

0 commit comments

Comments
 (0)