File tree Expand file tree Collapse file tree 5 files changed +38
-30
lines changed Expand file tree Collapse file tree 5 files changed +38
-30
lines changed Original file line number Diff line number Diff line change @@ -5,4 +5,4 @@ dependencies:
5
5
6
6
test :
7
7
post :
8
- - bats *.bats
8
+ - bats . lib
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -o errexit
3
+
4
+ source lib/batslib.bash
5
+
6
+ assert () {
7
+ [[ $1 = that ]] && shift
8
+
9
+ case $@ in
10
+ * ' = ' * ) assert_equal $1 " ${*: 3} " ;;
11
+ ' output contains ' * ) assert_output -p " ${*: 3} " ;;
12
+ ' output does not contain ' * ) refute_output -p " ${*: 5} " ;;
13
+ * ) fail invalid assertion: $@
14
+ esac
15
+ }
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bats
2
+
3
+ load assert
4
+
5
+ @test ' assert asserts equality' {
6
+ assert that 1 = 1
7
+ }
8
+ @test ' asserts output content' {
9
+ run echo abc
10
+ assert that output contains b
11
+ }
12
+ @test ' refutes output content' {
13
+ run echo abc
14
+ assert that output does not contain d
15
+ }
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bats
2
2
3
- source lib/batslib.bash
4
-
5
- assert () {
6
- [[ $1 = that ]] && shift
7
-
8
- case $@ in
9
- * ' = ' * ) assert_equal $1 " ${*: 3} " ;;
10
- ' output contains ' * ) assert_output -p " ${*: 3} " ;;
11
- ' output does not contain ' * ) refute_output -p " ${*: 5} " ;;
12
- * ) fail invalid assertion: $@
13
- esac
14
- }
15
-
16
- @test ' assert asserts equality' {
17
- assert that 1 = 1
18
- }
19
- @test ' asserts output content' {
20
- run echo abc
21
- assert that output contains b
22
- }
23
- @test ' refutes output content' {
24
- run echo abc
25
- assert that output does not contain d
26
- }
27
-
3
+ source lib/assert.bash
28
4
source deploy.sh --source-only
29
5
30
6
repo=https://secret@github.com/user/repo.git
Original file line number Diff line number Diff line change 2
2
3
3
# uses entr to watch for changes: http://entrproject.org
4
4
5
- # re-run any individual .bats file when it changes. -p to postpone the first execution, since the 2nd entr command below will run all the .bats files.
6
- ls * .bats | entr -p bats /_ &
5
+ # re-run any individual .bats file when it changes. -p to postpone the first execution, since the commands below will run all the .bats files.
6
+ shopt -s globstar
7
+ ls ** /* .bats | entr -p bats /_ &
7
8
8
- # re-run all tests when the script under test changes.
9
- echo deploy.sh | entr bats .
9
+ # re-run relevant tests when a source file changes.
10
+ echo deploy.sh | entr bats . &
11
+ ls lib/* .bash | entr bats lib
You can’t perform that action at this time.
0 commit comments