feat: add tests
This commit is contained in:
19
__std/misc/src/bin/enum_test.rs
Normal file
19
__std/misc/src/bin/enum_test.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
enum Os {
|
||||
Windows,
|
||||
Linux,
|
||||
Other(String),
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let os = Os::Other("Unix".to_string());
|
||||
match &os {
|
||||
Os::Windows => println!("OS is Windows."),
|
||||
Os::Other(name) if name == "Unix" => println!("OS is Unix"),
|
||||
Os::Other(name) => println!("OS is other: {}", name),
|
||||
_ => {} // IGNORE
|
||||
}
|
||||
|
||||
// if let Os::Windows = os {
|
||||
// println!("OS is Windows");
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user