diff --git a/exercises/practice/wordy/.meta/template.j2 b/exercises/practice/wordy/.meta/template.j2 new file mode 100644 index 00000000..013e8104 --- /dev/null +++ b/exercises/practice/wordy/.meta/template.j2 @@ -0,0 +1,32 @@ +{{ header }} +{% for idx, case in cases %} +@test "{{ case["description"] }}" { + {% if idx == 0 %}# {% endif %}[[ $BATS_RUN_SKIPPED == "true" ]] || skip + run bash {{ solution }} "{{ case["input"]["question"] }}" +{%- if case["expect_error"] %} + assert_failure + assert_output "{{ case["expect_error_msg"] }}" +{%- else %} + assert_success + assert_output "{{ case["expected"] }}" +{%- endif %} +} +{% endfor %} + +# Track specific tests + +@test "strict left to right, ignores typical order of operations" { + [[ $BATS_RUN_SKIPPED == "true" ]] || skip + run bash {{ solution }} "What is 2 plus 3 multiplied by 4?" + assert_success + [[ $output != "14" ]] + assert_output "20" +} + +@test "reject problem with no operands" { + [[ $BATS_RUN_SKIPPED == "true" ]] || skip + run bash {{ solution }} "What is plus?" + assert_failure + assert_output "syntax error" +} + diff --git a/exercises/practice/wordy/wordy.bats b/exercises/practice/wordy/wordy.bats index 75132802..5e0da161 100644 --- a/exercises/practice/wordy/wordy.bats +++ b/exercises/practice/wordy/wordy.bats @@ -1,8 +1,11 @@ #!/usr/bin/env bats load bats-extra +# generated on 2026-06-29T06:08:31+00:00 +# local version: 2.0.0.0 + @test "just a number" { - #[[ $BATS_RUN_SKIPPED == "true" ]] || skip + # [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash wordy.sh "What is 5?" assert_success assert_output "5" @@ -134,14 +137,6 @@ load bats-extra assert_output "2" } -@test "strict left to right, ignores typical order of operations" { - [[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash wordy.sh "What is 2 plus 3 multiplied by 4?" - assert_success - [[ $output != "14" ]] - assert_output "20" -} - @test "unknown operation" { [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash wordy.sh "What is 52 cubed?" @@ -156,13 +151,6 @@ load bats-extra assert_output "unknown operation" } -@test "reject problem with no operands" { - [[ $BATS_RUN_SKIPPED == "true" ]] || skip - run bash wordy.sh "What is plus?" - assert_failure - assert_output "syntax error" -} - @test "reject problem missing an operand" { [[ $BATS_RUN_SKIPPED == "true" ]] || skip run bash wordy.sh "What is 1 plus?" @@ -204,3 +192,21 @@ load bats-extra assert_failure assert_output "syntax error" } + + +# Track specific tests + +@test "strict left to right, ignores typical order of operations" { + [[ $BATS_RUN_SKIPPED == "true" ]] || skip + run bash wordy.sh "What is 2 plus 3 multiplied by 4?" + assert_success + [[ $output != "14" ]] + assert_output "20" +} + +@test "reject problem with no operands" { + [[ $BATS_RUN_SKIPPED == "true" ]] || skip + run bash wordy.sh "What is plus?" + assert_failure + assert_output "syntax error" +}