From ee84711b09b07d5edbba94b202ac671f0e1c7522 Mon Sep 17 00:00:00 2001 From: Isaac Good Date: Fri, 26 Jun 2026 18:40:26 -0700 Subject: [PATCH] [bob] Sync exercise: add a new test and reorder existing tests --- exercises/practice/bob/.meta/tests.toml | 83 +++++++-------- exercises/practice/bob/bob.bats | 131 +++++++++++++----------- 2 files changed, 112 insertions(+), 102 deletions(-) diff --git a/exercises/practice/bob/.meta/tests.toml b/exercises/practice/bob/.meta/tests.toml index 5299e289..0e30c5a0 100644 --- a/exercises/practice/bob/.meta/tests.toml +++ b/exercises/practice/bob/.meta/tests.toml @@ -9,17 +9,20 @@ # As user-added comments (using the # character) will be removed when this file # is regenerated, comments can be added via a `comment` key. -[e162fead-606f-437a-a166-d051915cea8e] -description = "stating something" +[8a2e771d-d6f1-4e3f-b6c6-b41495556e37] +description = "asking a question" [73a966dc-8017-47d6-bb32-cf07d1a5fcd9] description = "shouting" -[d6c98afd-df35-4806-b55e-2c457c3ab748] -description = "shouting gibberish" +[a5193c61-4a92-4f68-93e2-f554eb385ec6] +description = "forceful question" -[8a2e771d-d6f1-4e3f-b6c6-b41495556e37] -description = "asking a question" +[bc39f7c6-f543-41be-9a43-fd1c2f753fc0] +description = "silence" + +[e162fead-606f-437a-a166-d051915cea8e] +description = "stating something" [81080c62-4e4d-4066-b30a-48d8d76920d9] description = "asking a numeric question" @@ -27,23 +30,30 @@ description = "asking a numeric question" [2a02716d-685b-4e2e-a804-2adaf281c01e] description = "asking gibberish" -[c02f9179-ab16-4aa7-a8dc-940145c385f7] -description = "talking forcefully" +[bb0011c5-cd52-4a5b-8bfb-a87b6283b0e2] +description = "question with no letters" -[153c0e25-9bb5-4ec5-966e-598463658bcd] -description = "using acronyms in regular speech" +[9bfc677d-ea3a-45f2-be44-35bc8fa3753e] +description = "non-letters with question" -[a5193c61-4a92-4f68-93e2-f554eb385ec6] -description = "forceful question" +[8608c508-f7de-4b17-985b-811878b3cf45] +description = "prattling on" -[a20e0c54-2224-4dde-8b10-bd2cdd4f61bc] -description = "shouting numbers" +[05b304d6-f83b-46e7-81e0-4cd3ca647900] +description = "ending with whitespace" -[f7bc4b92-bdff-421e-a238-ae97f230ccac] -description = "no letters" +[2c7278ac-f955-4eb4-bf8f-e33eb4116a15] +description = "multiple line question" +reimplements = "66953780-165b-4e7e-8ce3-4bcb80b6385a" -[bb0011c5-cd52-4a5b-8bfb-a87b6283b0e2] -description = "question with no letters" +[d6c98afd-df35-4806-b55e-2c457c3ab748] +description = "shouting gibberish" + +[3c954328-86fb-4c71-8961-e18d6a5e2517] +description = "shouting a statement containing a question mark" + +[a20e0c54-2224-4dde-8b10-bd2cdd4f61bc] +description = "shouting numbers" [496143c8-1c31-4c01-8a08-88427af85c66] description = "shouting with special characters" @@ -51,24 +61,27 @@ description = "shouting with special characters" [e6793c1c-43bd-4b8d-bc11-499aea73925f] description = "shouting with no exclamation mark" -[aa8097cc-c548-4951-8856-14a404dd236a] -description = "statement containing question mark" - -[9bfc677d-ea3a-45f2-be44-35bc8fa3753e] -description = "non-letters with question" - -[8608c508-f7de-4b17-985b-811878b3cf45] -description = "prattling on" - -[bc39f7c6-f543-41be-9a43-fd1c2f753fc0] -description = "silence" - [d6c47565-372b-4b09-b1dd-c40552b8378b] description = "prolonged silence" [4428f28d-4100-4d85-a902-e5a78cb0ecd3] description = "alternate silence" +[72bd5ad3-9b2f-4931-a988-dce1f5771de2] +description = "other whitespace" + +[c02f9179-ab16-4aa7-a8dc-940145c385f7] +description = "talking forcefully" + +[153c0e25-9bb5-4ec5-966e-598463658bcd] +description = "using acronyms in regular speech" + +[f7bc4b92-bdff-421e-a238-ae97f230ccac] +description = "no letters" + +[aa8097cc-c548-4951-8856-14a404dd236a] +description = "statement containing question mark" + [66953780-165b-4e7e-8ce3-4bcb80b6385a] description = "multiple line question" include = false @@ -76,15 +89,5 @@ include = false [5371ef75-d9ea-4103-bcfa-2da973ddec1b] description = "starting with whitespace" -[05b304d6-f83b-46e7-81e0-4cd3ca647900] -description = "ending with whitespace" - -[72bd5ad3-9b2f-4931-a988-dce1f5771de2] -description = "other whitespace" - [12983553-8601-46a8-92fa-fcaa3bc4a2a0] description = "non-question ending with whitespace" - -[2c7278ac-f955-4eb4-bf8f-e33eb4116a15] -description = "multiple line question" -reimplements = "66953780-165b-4e7e-8ce3-4bcb80b6385a" diff --git a/exercises/practice/bob/bob.bats b/exercises/practice/bob/bob.bats index efb7351d..483257d7 100644 --- a/exercises/practice/bob/bob.bats +++ b/exercises/practice/bob/bob.bats @@ -3,11 +3,11 @@ load bats-extra # local version: 1.6.0.0 -@test "stating something" { +@test "asking a question" { #[[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash bob.sh 'Tom-ay-to, tom-aaaah-to.' + run bash bob.sh 'Does this cryogenic chamber make me look fat?' assert_success - assert_output "Whatever." + assert_output "Sure." } @test "shouting" { @@ -17,18 +17,25 @@ load bats-extra assert_output "Whoa, chill out!" } -@test "shouting gibberish" { +@test "forceful question" { [[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash bob.sh 'FCECDFCAAB' + run bash bob.sh "WHAT'S GOING ON?" assert_success - assert_output "Whoa, chill out!" + assert_output "Calm down, I know what I'm doing!" } -@test "asking a question" { +@test "silence" { [[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash bob.sh 'Does this cryogenic chamber make me look fat?' + run bash bob.sh '' assert_success - assert_output "Sure." + assert_output "Fine. Be that way!" +} + +@test "stating something" { + [[ $BATS_RUN_SKIPPED == "true" ]] || skip + run bash bob.sh 'Tom-ay-to, tom-aaaah-to.' + assert_success + assert_output "Whatever." } @test "asking a numeric question" { @@ -45,130 +52,130 @@ load bats-extra assert_output "Sure." } -@test "talking forcefully" { +@test "question with no letters" { [[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash bob.sh "Hi there!" + run bash bob.sh '4?' assert_success - assert_output "Whatever." + assert_output "Sure." } -@test "using acronyms in regular speech" { +@test "non-letters with question" { [[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash bob.sh "It's OK if you don't want to go work for NASA." + run bash bob.sh ':) ?' assert_success - assert_output "Whatever." + assert_output "Sure." } -@test "forceful question" { +@test "prattling on" { [[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash bob.sh "WHAT'S GOING ON?" + run bash bob.sh 'Wait! Hang on. Are you going to be OK?' assert_success - assert_output "Calm down, I know what I'm doing!" + assert_output "Sure." } -@test "shouting numbers" { +@test "ending with whitespace" { [[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash bob.sh '1, 2, 3 GO!' + run bash bob.sh 'Okay if like my spacebar quite a bit? ' assert_success - assert_output "Whoa, chill out!" + assert_output "Sure." } - -@test "no letters" { +# This test might act differently depending on your platform +@test "multiple line question" { [[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash bob.sh '1, 2, 3' + run bash bob.sh $'\nDoes this cryogenic chamber make\n me look fat?' assert_success - assert_output "Whatever." + assert_output "Sure." } -@test "question with no letters" { +@test "shouting gibberish" { [[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash bob.sh '4?' + run bash bob.sh 'FCECDFCAAB' assert_success - assert_output "Sure." + assert_output "Whoa, chill out!" } -@test "shouting with special characters" { - [[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash bob.sh 'ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!' +@test "shouting a statement containing a question mark" { + $BATS_RUN_SKIPPED == "true" ]] || skip + run bash bob.sh 'DO LIONS EAT PEOPLE? AHHHHH.' assert_success assert_output "Whoa, chill out!" } -@test "shouting with no exclamation mark" { +@test "shouting numbers" { [[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash bob.sh 'I HATE THE DENTIST' + run bash bob.sh '1, 2, 3 GO!' assert_success assert_output "Whoa, chill out!" } -@test "statement containing question mark" { +@test "shouting with special characters" { [[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash bob.sh 'Ending with ? means a question.' + run bash bob.sh 'ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!' assert_success - assert_output "Whatever." + assert_output "Whoa, chill out!" } -@test "non-letters with question" { +@test "shouting with no exclamation mark" { [[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash bob.sh ':) ?' + run bash bob.sh 'I HATE THE DENTIST' assert_success - assert_output "Sure." + assert_output "Whoa, chill out!" } -@test "prattling on" { +@test "prolonged silence" { [[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash bob.sh 'Wait! Hang on. Are you going to be OK?' + run bash bob.sh ' ' assert_success - assert_output "Sure." + assert_output "Fine. Be that way!" } -@test "silence" { +@test "alternate silence" { [[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash bob.sh '' + run bash bob.sh $'\t\t\t\t\t\t\t\t\t\t' assert_success assert_output "Fine. Be that way!" } -@test "prolonged silence" { +@test "other whitespace" { [[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash bob.sh ' ' + run bash bob.sh $'\n\r \t' assert_success assert_output "Fine. Be that way!" } -@test "alternate silence" { +@test "talking forcefully" { [[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash bob.sh $'\t\t\t\t\t\t\t\t\t\t' + run bash bob.sh "Hi there!" assert_success - assert_output "Fine. Be that way!" + assert_output "Whatever." } -@test "multiple line question" { +@test "using acronyms in regular speech" { [[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash bob.sh $'\nDoes this cryogenic chamber make\n me look fat?' + run bash bob.sh "It's OK if you don't want to go work for NASA." assert_success - assert_output "Sure." + assert_output "Whatever." } -@test "starting with whitespace" { +@test "no letters" { [[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash bob.sh ' hmmmmmmm...' + run bash bob.sh '1, 2, 3' assert_success assert_output "Whatever." } -@test "ending with whitespace" { +@test "statement containing question mark" { [[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash bob.sh 'Okay if like my spacebar quite a bit? ' + run bash bob.sh 'Ending with ? means a question.' assert_success - assert_output "Sure." + assert_output "Whatever." } -# This test might act differently depending on your platform -@test "other whitespace" { + +@test "starting with whitespace" { [[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash bob.sh $'\n\r \t' + run bash bob.sh ' hmmmmmmm...' assert_success - assert_output "Fine. Be that way!" + assert_output "Whatever." } @test "non-question ending with whitespace" { @@ -178,6 +185,7 @@ load bats-extra assert_output "Whatever." } +# bash-specific tests @test "no input is silence" { [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash bob.sh @@ -185,7 +193,6 @@ load bats-extra assert_output "Fine. Be that way!" } -# bash-specific tests @test "yelling a filename expansion" { [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash bob.sh '*READ* !'