Skip to content

Commit 1e39915

Browse files
authored
Merge pull request #418 from petertseng/bob
bob 1.1.0: Add yelling question rule
2 parents a2851a6 + bf2fa07 commit 1e39915

File tree

4 files changed

+5
-2
lines changed

4 files changed

+5
-2
lines changed

exercises/bob/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[package]
22
name = "bob"
3-
version = "1.0.0"
3+
version = "1.1.0"

exercises/bob/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Bob answers 'Sure.' if you ask him a question.
66

77
He answers 'Whoa, chill out!' if you yell at him.
88

9+
He answers 'Calm down, I know what I'm doing!' if you yell a question at him.
10+
911
He says 'Fine. Be that way!' if you address him without actually saying
1012
anything.
1113

exercises/bob/example.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
pub fn reply(message: &str) -> &str {
22
if is_silence(message) { "Fine. Be that way!" }
3+
else if is_yelling(message) && is_question(message) { "Calm down, I know what I'm doing!" }
34
else if is_yelling(message) { "Whoa, chill out!" }
45
else if is_question(message) { "Sure." }
56
else { "Whatever." }

exercises/bob/tests/bob.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fn test_using_acronyms_in_regular_speech() {
5252
#[test]
5353
#[ignore]
5454
fn test_forceful_question() {
55-
assert_eq!("Whoa, chill out!",
55+
assert_eq!("Calm down, I know what I'm doing!",
5656
bob::reply("WHAT THE HELL WERE YOU THINKING?"));
5757
}
5858

0 commit comments

Comments
 (0)