Skip to content

Commit 8b640eb

Browse files
committed
move it to the bottom
1 parent 0788a12 commit 8b640eb

File tree

1 file changed

+35
-30
lines changed

1 file changed

+35
-30
lines changed

exercises/shared/.docs/tests.md

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,35 @@ echo "some,input,here" | gawk -f some-exercise.awk
2828
The tests use functions from the [bats-assert][bats-assert] library.
2929
Help for the various `assert*` functions can be found there.
3030

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+
3160
## Debugging output
3261

3362
```exercism/caution
@@ -69,40 +98,16 @@ Hiding the details in a function may improve readability if you use it in severa
6998

7099
```awk
71100
BEGIN {
72-
debug("a debug message")
73-
print "Hello, World!"
101+
debug("starting ...")
74102
}
75103
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 ...
91105
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")
101108
}
102-
```
103-
Then run tests with just:
104-
```bash
105-
bats
109+
110+
function debug(msg) {print msg > "/dev/fd/3"}
106111
```
107112

108113
[bash]: https://exercism.org/docs/tracks/bash/tests

0 commit comments

Comments
 (0)