mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-07 03:09:19 +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 {
|
pub fn fizz_if_foo(fizzish: &str) -> &str {
|
||||||
if fizzish == "fizz" {
|
if fizzish == "fizz" {
|
||||||
"foo"
|
"foo"
|
||||||
|
} else if fizzish == "fuzz" {
|
||||||
|
"bar"
|
||||||
} else {
|
} else {
|
||||||
1
|
"baz"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,4 +35,8 @@ mod tests {
|
|||||||
fn default_to_baz() {
|
fn default_to_baz() {
|
||||||
assert_eq!(fizz_if_foo("literally anything"), "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