Skip to content

Commit de2c48c

Browse files
omasanorialexcrichton
authored andcommitted
Add tests for from_bits.
Signed-off-by: OGINO Masanori <[email protected]>
1 parent 24ece07 commit de2c48c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/libstd/bitflags.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,13 @@ mod tests {
207207
assert_eq!(FlagABC.bits(), 0x00000111);
208208
}
209209

210+
#[test]
211+
fn test_from_bits() {
212+
assert!(unsafe { Flags::from_bits(0x00000000) } == Flags::empty());
213+
assert!(unsafe { Flags::from_bits(0x00000001) } == FlagA);
214+
assert!(unsafe { Flags::from_bits(0x00000111) } == FlagABC);
215+
}
216+
210217
#[test]
211218
fn test_is_empty(){
212219
assert!(Flags::empty().is_empty());

0 commit comments

Comments
 (0)