Skip to content

Commit 888f3e2

Browse files
authored
[say] Add a Jinja test template (#863)
[no important files changed]
1 parent 5375799 commit 888f3e2

2 files changed

Lines changed: 24 additions & 8 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{ header }}
2+
{% for idx, case in cases %}
3+
@test "{{ case["description"] }}" {
4+
{% if idx == 0 %}# {% endif %}[[ $BATS_RUN_SKIPPED == "true" ]] || skip
5+
run bash {{ solution }} {{ case["input"]["number"] }}
6+
{%- if case["expect_error"] %}
7+
assert_failure
8+
assert_output "{{ case["expect_error_msg"] }}"
9+
{%- else %}
10+
assert_success
11+
assert_output "{{ case["expected"] }}"
12+
{%- endif %}
13+
}
14+
{% endfor %}

exercises/practice/say/say.bats

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
11
#!/usr/bin/env bats
22
load bats-extra
33

4-
# local version: 1.2.0.0
4+
# generated on 2026-06-29T05:47:57+00:00
5+
# local version: 2.0.0.0
56

6-
@test zero {
7-
#[[ $BATS_RUN_SKIPPED == "true" ]] || skip
7+
@test "zero" {
8+
# [[ $BATS_RUN_SKIPPED == "true" ]] || skip
89
run bash say.sh 0
910
assert_success
1011
assert_output "zero"
1112
}
1213

13-
@test one {
14+
@test "one" {
1415
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
1516
run bash say.sh 1
1617
assert_success
1718
assert_output "one"
1819
}
1920

20-
@test fourteen {
21+
@test "fourteen" {
2122
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
2223
run bash say.sh 14
2324
assert_success
2425
assert_output "fourteen"
2526
}
2627

27-
@test twenty {
28+
@test "twenty" {
2829
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
2930
run bash say.sh 20
3031
assert_success
@@ -38,12 +39,13 @@ load bats-extra
3839
assert_output "twenty-two"
3940
}
4041

41-
@test thirty {
42+
@test "thirty" {
4243
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
4344
run bash say.sh 30
4445
assert_success
4546
assert_output "thirty"
4647
}
48+
4749
@test "ninety-nine" {
4850
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
4951
run bash say.sh 99
@@ -116,7 +118,7 @@ load bats-extra
116118

117119
@test "a big number" {
118120
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
119-
run bash say.sh 987654321123
121+
run bash say.sh 987654321123
120122
assert_success
121123
assert_output "nine hundred eighty-seven billion six hundred fifty-four million three hundred twenty-one thousand one hundred twenty-three"
122124
}

0 commit comments

Comments
 (0)