@@ -28,6 +28,35 @@ echo "some,input,here" | gawk -f some-exercise.awk
28
28
The tests use functions from the [ bats-assert] [ bats-assert ] library.
29
29
Help for the various ` assert* ` functions can be found there.
30
30
31
+ ## Skipped tests
32
+
33
+ Solving an exercise means making all its tests pass.
34
+ By default, only one test (the first one) is executed when you run the tests.
35
+ This is intentional, as it allows you to focus on just making that one test pass.
36
+ Once it passes, you can enable the next test by commenting out or removing the
37
+
38
+ [[ $BATS_RUN_SKIPPED == true ]] || skip
39
+
40
+ annotations prepending other tests.
41
+
42
+ ## Overriding skips
43
+
44
+ To run all tests, including the ones with ` skip ` annotations, you can run:
45
+ ``` bash
46
+ BATS_RUN_SKIPPED=true bats test-some-exercise.bats
47
+ ```
48
+
49
+ It can be convenient to use a wrapper function to save on typing: in ` bash ` you can do:
50
+ ``` bash
51
+ bats () {
52
+ BATS_RUN_SKIPPED=true command bats * .bats
53
+ }
54
+ ```
55
+ Then run tests with just:
56
+ ``` bash
57
+ bats
58
+ ```
59
+
31
60
## Debugging output
32
61
33
62
``` exercism/caution
@@ -69,40 +98,16 @@ Hiding the details in a function may improve readability if you use it in severa
69
98
70
99
``` awk
71
100
BEGIN {
72
- debug("a debug message")
73
- print "Hello, World!"
101
+ debug("starting ...")
74
102
}
75
103
76
- function debug(msg) {print msg > "/dev/fd/3"}
77
- ```
78
-
79
- ## Skipped tests
80
-
81
- Solving an exercise means making all its tests pass.
82
- By default, only one test (the first one) is executed when you run the tests.
83
- This is intentional, as it allows you to focus on just making that one test pass.
84
- Once it passes, you can enable the next test by commenting out or removing the
85
-
86
- [[ $BATS_RUN_SKIPPED == true ]] || skip
87
-
88
- annotations prepending other tests.
89
-
90
- ## Overriding skips
104
+ # do stuff here ...
91
105
92
- To run all tests, including the ones with ` skip ` annotations, you can run:
93
- ``` bash
94
- BATS_RUN_SKIPPED=true bats test-some-exercise.bats
95
- ```
96
-
97
- It can be convenient to use a wrapper function to save on typing: in ` bash ` you can do:
98
- ``` bash
99
- bats () {
100
- BATS_RUN_SKIPPED=true command bats * .bats
106
+ END {
107
+ debug("... finished")
101
108
}
102
- ```
103
- Then run tests with just:
104
- ``` bash
105
- bats
109
+
110
+ function debug(msg) {print msg > "/dev/fd/3"}
106
111
```
107
112
108
113
[ bash ] : https://exercism.org/docs/tracks/bash/tests
0 commit comments