Update if2.rs

This commit is contained in:
Grimhiker 2020-06-18 11:54:28 -05:00 committed by GitHub
parent 55a9284665
commit b2e07c1908
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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")
}
} }