mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-05 10:19:18 +00:00
Update if2.rs
This commit is contained in:
parent
55a9284665
commit
b2e07c1908
@ -9,8 +9,10 @@
|
||||
pub fn fizz_if_foo(fizzish: &str) -> &str {
|
||||
if fizzish == "fizz" {
|
||||
"foo"
|
||||
} else if fizzish == "fuzz" {
|
||||
"bar"
|
||||
} else {
|
||||
1
|
||||
"baz"
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,4 +35,8 @@ mod tests {
|
||||
fn default_to_baz() {
|
||||
assert_eq!(fizz_if_foo("literally anything"), "baz")
|
||||
}
|
||||
#[test]
|
||||
fn default_to_baz2() {
|
||||
assert_eq!(fizz_if_foo("other thing"), "baz")
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user