busser-bats 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/publish.yml +22 -0
- data/.gitignore +0 -1
- data/.release-please-manifest.json +1 -1
- data/.rubocop.yml +1 -4
- data/CHANGELOG.md +11 -0
- data/CONTRIBUTING.md +86 -0
- data/Gemfile +7 -5
- data/README.md +100 -28
- data/Rakefile +42 -15
- data/config/features/support/env.rb +0 -5
- data/features/support/env.rb +0 -12
- data/features/test_command.feature +31 -31
- data/lib/busser/bats/version.rb +3 -1
- data/lib/busser/runner_plugin/bats.rb +27 -3
- data/spec/busser/runner_plugin/bats_spec.rb +41 -0
- data/spec/spec_helper.rb +2 -0
- data/vendor/bats/LICENSE.md +53 -0
- data/vendor/bats/README.md +84 -242
- data/vendor/bats/VERSION.txt +1 -1
- data/vendor/bats/bin/bats +75 -0
- data/vendor/bats/install.sh +20 -28
- data/vendor/bats/lib/bats-core/common.bash +278 -0
- data/vendor/bats/lib/bats-core/formatter.bash +151 -0
- data/vendor/bats/lib/bats-core/preprocessing.bash +19 -0
- data/vendor/bats/lib/bats-core/semaphore.bash +113 -0
- data/vendor/bats/lib/bats-core/test_functions.bash +539 -0
- data/vendor/bats/lib/bats-core/tracing.bash +425 -0
- data/vendor/bats/lib/bats-core/validator.bash +37 -0
- data/vendor/bats/lib/bats-core/warnings.bash +44 -0
- data/vendor/bats/libexec/bats-core/bats +549 -0
- data/vendor/bats/libexec/bats-core/bats-exec-file +402 -0
- data/vendor/bats/libexec/bats-core/bats-exec-suite +342 -0
- data/vendor/bats/libexec/bats-core/bats-exec-test +383 -0
- data/vendor/bats/libexec/bats-core/bats-format-cat +6 -0
- data/vendor/bats/libexec/bats-core/bats-format-junit +293 -0
- data/vendor/bats/libexec/bats-core/bats-format-pretty +360 -0
- data/vendor/bats/libexec/bats-core/bats-format-tap +55 -0
- data/vendor/bats/libexec/bats-core/bats-format-tap13 +89 -0
- data/vendor/bats/libexec/bats-core/bats-gather-tests +402 -0
- data/vendor/bats/libexec/bats-core/bats-preprocess +118 -0
- data/vendor/bats/man/Makefile +16 -3
- data/vendor/bats/man/bats.1 +100 -58
- data/vendor/bats/man/bats.1.ronn +102 -12
- data/vendor/bats/man/bats.7 +205 -83
- data/vendor/bats/man/bats.7.ronn +262 -14
- data/vendor/bats/uninstall.sh +63 -0
- metadata +25 -6
- data/.tool-versions +0 -1
- data/vendor/bats/.gitattributes +0 -3
- data/vendor/bats/.travis.yml +0 -5
- data/vendor/bats/LICENSE +0 -20
- data/vendor/bats/bin/bats +0 -1
- data/vendor/bats/package.json +0 -9
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
Copyright (c) 2017 bats-core contributors
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
* [bats-core] is a continuation of [bats]. Copyright for portions of the
|
|
25
|
+
bats-core project are held by Sam Stephenson, 2014 as part of the project
|
|
26
|
+
[bats], licensed under MIT:
|
|
27
|
+
|
|
28
|
+
Copyright (c) 2014 Sam Stephenson
|
|
29
|
+
|
|
30
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
31
|
+
a copy of this software and associated documentation files (the
|
|
32
|
+
"Software"), to deal in the Software without restriction, including
|
|
33
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
34
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
35
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
36
|
+
the following conditions:
|
|
37
|
+
|
|
38
|
+
The above copyright notice and this permission notice shall be
|
|
39
|
+
included in all copies or substantial portions of the Software.
|
|
40
|
+
|
|
41
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
42
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
43
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
44
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
45
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
46
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
47
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
48
|
+
|
|
49
|
+
For details, please see the [version control history][commits].
|
|
50
|
+
|
|
51
|
+
[bats-core]: https://github.com/bats-core/bats-core
|
|
52
|
+
[bats]:https://github.com/sstephenson/bats
|
|
53
|
+
[commits]:https://github.com/bats-core/bats-core/commits/master
|
data/vendor/bats/README.md
CHANGED
|
@@ -1,12 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
[](https://github.com/bats-core/bats-core/releases/latest)
|
|
2
|
+
[](https://www.npmjs.com/package/bats)
|
|
3
|
+
[](https://github.com/bats-core/bats-core/blob/master/LICENSE.md)
|
|
4
|
+
[](https://github.com/bats-core/bats-core/actions?query=workflow%3ATests)
|
|
5
|
+
[](https://bats-core.readthedocs.io)
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
for Bash. It provides a simple way to verify that the UNIX programs
|
|
5
|
-
you write behave as expected.
|
|
7
|
+
[][gitter]
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
<div align="center">
|
|
10
|
+
<picture>
|
|
11
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/source/assets/dark_mode_cube.svg">
|
|
12
|
+
<img alt="" src="docs/source/assets/light_mode_cube.svg">
|
|
13
|
+
</picture>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
# Bats-core: Bash Automated Testing System
|
|
17
|
+
|
|
18
|
+
Bats is a [TAP](https://testanything.org/)-compliant testing framework for Bash
|
|
19
|
+
3.2 or above. It provides a simple way to verify that the UNIX programs you
|
|
20
|
+
write behave as expected.
|
|
21
|
+
|
|
22
|
+
A Bats test file is a Bash script with special syntax for defining test cases.
|
|
23
|
+
Under the hood, each test case is just a function with a description.
|
|
10
24
|
|
|
11
25
|
```bash
|
|
12
26
|
#!/usr/bin/env bats
|
|
@@ -22,272 +36,100 @@ description.
|
|
|
22
36
|
}
|
|
23
37
|
```
|
|
24
38
|
|
|
25
|
-
Bats is most useful when testing software written in Bash, but you can
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
Test cases consist of standard shell commands. Bats makes use of
|
|
29
|
-
Bash's `errexit` (`set -e`) option when running test cases. If every
|
|
30
|
-
command in the test case exits with a `0` status code (success), the
|
|
31
|
-
test passes. In this way, each line is an assertion of truth.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
## Running tests
|
|
35
|
-
|
|
36
|
-
To run your tests, invoke the `bats` interpreter with a path to a test
|
|
37
|
-
file. The file's test cases are run sequentially and in isolation. If
|
|
38
|
-
all the test cases pass, `bats` exits with a `0` status code. If there
|
|
39
|
-
are any failures, `bats` exits with a `1` status code.
|
|
40
|
-
|
|
41
|
-
When you run Bats from a terminal, you'll see output as each test is
|
|
42
|
-
performed, with a check-mark next to the test's name if it passes or
|
|
43
|
-
an "X" if it fails.
|
|
44
|
-
|
|
45
|
-
$ bats addition.bats
|
|
46
|
-
✓ addition using bc
|
|
47
|
-
✓ addition using dc
|
|
48
|
-
|
|
49
|
-
2 tests, 0 failures
|
|
50
|
-
|
|
51
|
-
If Bats is not connected to a terminal—in other words, if you
|
|
52
|
-
run it from a continuous integration system, or redirect its output to
|
|
53
|
-
a file—the results are displayed in human-readable, machine-parsable
|
|
54
|
-
[TAP format](http://testanything.org).
|
|
55
|
-
|
|
56
|
-
You can force TAP output from a terminal by invoking Bats with the
|
|
57
|
-
`--tap` option.
|
|
58
|
-
|
|
59
|
-
$ bats --tap addition.bats
|
|
60
|
-
1..2
|
|
61
|
-
ok 1 addition using bc
|
|
62
|
-
ok 2 addition using dc
|
|
39
|
+
Bats is most useful when testing software written in Bash, but you can use it to
|
|
40
|
+
test any UNIX program.
|
|
63
41
|
|
|
64
|
-
|
|
42
|
+
Test cases consist of standard shell commands. Bats makes use of Bash's
|
|
43
|
+
`errexit` (`set -e`) option when running test cases. If every command in the
|
|
44
|
+
test case exits with a `0` status code (success), the test passes. In this way,
|
|
45
|
+
each line is an assertion of truth.
|
|
65
46
|
|
|
66
|
-
|
|
67
|
-
arguments, or with a path to a directory containing multiple `.bats`
|
|
68
|
-
files. Bats will run each test file individually and aggregate the
|
|
69
|
-
results. If any test case fails, `bats` exits with a `1` status code.
|
|
47
|
+
## Table of contents
|
|
70
48
|
|
|
49
|
+
**NOTE** The documentation has moved to <https://bats-core.readthedocs.io>
|
|
71
50
|
|
|
72
|
-
|
|
51
|
+
<!-- toc -->
|
|
73
52
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
53
|
+
- [Testing](#testing)
|
|
54
|
+
- [Support](#support)
|
|
55
|
+
- [Contributing](#contributing)
|
|
56
|
+
- [Contact](#contact)
|
|
57
|
+
- [Version history](#version-history)
|
|
58
|
+
- [Background](#background)
|
|
59
|
+
* [What's the plan and why?](#whats-the-plan-and-why)
|
|
60
|
+
* [Why was this fork created?](#why-was-this-fork-created)
|
|
61
|
+
- [Copyright](#copyright)
|
|
78
62
|
|
|
79
|
-
|
|
80
|
-
[Bats Evaluation Process](https://github.com/sstephenson/bats/wiki/Bats-Evaluation-Process)
|
|
81
|
-
on the wiki.
|
|
82
|
-
|
|
83
|
-
### `run`: Test other commands
|
|
63
|
+
<!-- tocstop -->
|
|
84
64
|
|
|
85
|
-
|
|
86
|
-
its exit status and output. Bats includes a `run` helper that invokes
|
|
87
|
-
its arguments as a command, saves the exit status and output into
|
|
88
|
-
special global variables, and then returns with a `0` status code so
|
|
89
|
-
you can continue to make assertions in your test case.
|
|
65
|
+
## Testing
|
|
90
66
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
an error message.
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
@test "invoking foo with a nonexistent file prints an error" {
|
|
97
|
-
run foo nonexistent_filename
|
|
98
|
-
[ "$status" -eq 1 ]
|
|
99
|
-
[ "$output" = "foo: no such file 'nonexistent_filename'" ]
|
|
100
|
-
}
|
|
67
|
+
```sh
|
|
68
|
+
bin/bats --tap test
|
|
101
69
|
```
|
|
102
70
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
standard output and standard error streams.
|
|
106
|
-
|
|
107
|
-
A third special variable, the `$lines` array, is available for easily
|
|
108
|
-
accessing individual lines of output. For example, if you want to test
|
|
109
|
-
that invoking `foo` without any arguments prints usage information on
|
|
110
|
-
the first line:
|
|
71
|
+
See also the [CI](./.github/workflows/tests.yml) settings for the current test environment and
|
|
72
|
+
scripts.
|
|
111
73
|
|
|
112
|
-
|
|
113
|
-
@test "invoking foo without arguments prints usage" {
|
|
114
|
-
run foo
|
|
115
|
-
[ "$status" -eq 1 ]
|
|
116
|
-
[ "${lines[0]}" = "usage: foo <filename>" ]
|
|
117
|
-
}
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### `load`: Share common code
|
|
121
|
-
|
|
122
|
-
You may want to share common code across multiple test files. Bats
|
|
123
|
-
includes a convenient `load` command for sourcing a Bash source file
|
|
124
|
-
relative to the location of the current test file. For example, if you
|
|
125
|
-
have a Bats test in `test/foo.bats`, the command
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
load test_helper
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
will source the script `test/test_helper.bash` in your test file. This
|
|
132
|
-
can be useful for sharing functions to set up your environment or load
|
|
133
|
-
fixtures.
|
|
134
|
-
|
|
135
|
-
### `skip`: Easily skip tests
|
|
136
|
-
|
|
137
|
-
Tests can be skipped by using the `skip` command at the point in a
|
|
138
|
-
test you wish to skip.
|
|
139
|
-
|
|
140
|
-
```bash
|
|
141
|
-
@test "A test I don't want to execute for now" {
|
|
142
|
-
skip
|
|
143
|
-
run foo
|
|
144
|
-
[ "$status" -eq 0 ]
|
|
145
|
-
}
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
Optionally, you may include a reason for skipping:
|
|
149
|
-
|
|
150
|
-
```bash
|
|
151
|
-
@test "A test I don't want to execute for now" {
|
|
152
|
-
skip "This command will return zero soon, but not now"
|
|
153
|
-
run foo
|
|
154
|
-
[ "$status" -eq 0 ]
|
|
155
|
-
}
|
|
156
|
-
```
|
|
74
|
+
## Support
|
|
157
75
|
|
|
158
|
-
|
|
76
|
+
The Bats source code repository is [hosted on
|
|
77
|
+
GitHub](https://github.com/bats-core/bats-core). There you can file bugs on the
|
|
78
|
+
issue tracker or submit tested pull requests for review.
|
|
159
79
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
skip "foo isn't bar"
|
|
164
|
-
fi
|
|
80
|
+
For real-world examples from open-source projects using Bats, see [Projects
|
|
81
|
+
Using Bats](https://github.com/bats-core/bats-core/wiki/Projects-Using-Bats) on
|
|
82
|
+
the wiki.
|
|
165
83
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
```
|
|
84
|
+
To learn how to set up your editor for Bats syntax highlighting, see [Syntax
|
|
85
|
+
Highlighting](https://github.com/bats-core/bats-core/wiki/Syntax-Highlighting)
|
|
86
|
+
on the wiki.
|
|
170
87
|
|
|
171
|
-
|
|
88
|
+
## Contributing
|
|
172
89
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
fixtures, set up your environment, and clean up when you're done.
|
|
90
|
+
For now see the [`docs`](docs) folder for project guides, work with us on the wiki
|
|
91
|
+
or look at the other communication channels.
|
|
176
92
|
|
|
177
|
-
|
|
93
|
+
## Contact
|
|
178
94
|
|
|
179
|
-
You can
|
|
180
|
-
For example, this may be useful if you want to check for dependencies
|
|
181
|
-
and fail immediately if they're not present. However, any output that
|
|
182
|
-
you print in code outside of `@test`, `setup` or `teardown` functions
|
|
183
|
-
must be redirected to `stderr` (`>&2`). Otherwise, the output may
|
|
184
|
-
cause Bats to fail by polluting the TAP stream on `stdout`.
|
|
95
|
+
- You can find and chat with us on our [Gitter].
|
|
185
96
|
|
|
186
|
-
|
|
97
|
+
## Version history
|
|
187
98
|
|
|
188
|
-
|
|
189
|
-
tests:
|
|
99
|
+
See `docs/CHANGELOG.md`.
|
|
190
100
|
|
|
191
|
-
|
|
192
|
-
file.
|
|
193
|
-
* `$BATS_TEST_DIRNAME` is the directory in which the Bats test file is
|
|
194
|
-
located.
|
|
195
|
-
* `$BATS_TEST_NAMES` is an array of function names for each test case.
|
|
196
|
-
* `$BATS_TEST_NAME` is the name of the function containing the current
|
|
197
|
-
test case.
|
|
198
|
-
* `$BATS_TEST_DESCRIPTION` is the description of the current test
|
|
199
|
-
case.
|
|
200
|
-
* `$BATS_TEST_NUMBER` is the (1-based) index of the current test case
|
|
201
|
-
in the test file.
|
|
202
|
-
* `$BATS_TMPDIR` is the location to a directory that may be used to
|
|
203
|
-
store temporary files.
|
|
101
|
+
## Background
|
|
204
102
|
|
|
103
|
+
<!-- markdownlint-disable MD026 -->
|
|
104
|
+
### Why was this fork created?
|
|
105
|
+
<!-- markdownlint-enable MD026 -->
|
|
205
106
|
|
|
206
|
-
|
|
107
|
+
There was an initial [call for maintainers][call-maintain] for the original Bats repository, but write access to it could not be obtained. With development activity stalled, this fork allowed ongoing maintenance and forward progress for Bats.
|
|
207
108
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
Bats. For example, to install Bats into `/usr/local`,
|
|
109
|
+
**Tuesday, September 19, 2017:** This was forked from [Bats][bats-orig] at
|
|
110
|
+
commit [0360811][]. It was created via `git clone --bare` and `git push
|
|
111
|
+
--mirror`.
|
|
212
112
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
$ ./install.sh /usr/local
|
|
113
|
+
As of **Thursday, April 29, 2021:** the original [Bats][bats-orig] has been
|
|
114
|
+
archived by the owner and is now read-only.
|
|
216
115
|
|
|
217
|
-
|
|
218
|
-
have permission to write to the installation prefix.
|
|
116
|
+
This [bats-core](https://github.com/bats-core/bats-core) repo is now the community-maintained Bats project.
|
|
219
117
|
|
|
118
|
+
[call-maintain]: https://github.com/sstephenson/bats/issues/150
|
|
119
|
+
[bats-orig]: https://github.com/sstephenson/bats
|
|
120
|
+
[0360811]: https://github.com/sstephenson/bats/commit/03608115df2071fff4eaaff1605768c275e5f81f
|
|
220
121
|
|
|
221
|
-
##
|
|
122
|
+
## Copyright
|
|
222
123
|
|
|
223
|
-
The Bats
|
|
224
|
-
GitHub](https://github.com/sstephenson/bats). There you can file bugs
|
|
225
|
-
on the issue tracker or submit tested pull requests for review.
|
|
124
|
+
The Bats Logo was created by [Vukory](https://www.artstation.com/vukory) ([Github](https://github.com/vukory)) and sponsored by [SethFalco](https://github.com/SethFalco). If you want to use our logo, have a look at our [guidelines](./docs/source/assets/README.md#Usage-Guide-for-Third-Parties).
|
|
226
125
|
|
|
227
|
-
|
|
228
|
-
[Projects Using Bats](https://github.com/sstephenson/bats/wiki/Projects-Using-Bats)
|
|
229
|
-
on the wiki.
|
|
126
|
+
© 2017-2024 bats-core organization
|
|
230
127
|
|
|
231
|
-
|
|
232
|
-
[Syntax Highlighting](https://github.com/sstephenson/bats/wiki/Syntax-Highlighting)
|
|
233
|
-
on the wiki.
|
|
128
|
+
© 2011-2016 Sam Stephenson
|
|
234
129
|
|
|
130
|
+
Bats is released under an MIT-style license; see `LICENSE.md` for details.
|
|
235
131
|
|
|
236
|
-
|
|
132
|
+
See the [parent project](https://github.com/bats-core) at GitHub or the
|
|
133
|
+
[AUTHORS](AUTHORS) file for the current project maintainer team.
|
|
237
134
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
* Improved the display of failing test cases. Bats now shows the
|
|
241
|
-
source code of failing test lines, along with full stack traces
|
|
242
|
-
including function names, filenames, and line numbers.
|
|
243
|
-
* Improved the display of the pretty-printed test summary line to
|
|
244
|
-
include the number of skipped tests, if any.
|
|
245
|
-
* Improved the speed of the preprocessor, dramatically shortening test
|
|
246
|
-
and suite startup times.
|
|
247
|
-
* Added support for absolute pathnames to the `load` helper.
|
|
248
|
-
* Added support for single-line `@test` definitions.
|
|
249
|
-
* Added bats(1) and bats(7) manual pages.
|
|
250
|
-
* Modified the `bats` command to default to TAP output when the `$CI`
|
|
251
|
-
variable is set, to better support environments such as Travis CI.
|
|
252
|
-
|
|
253
|
-
*0.3.1* (October 28, 2013)
|
|
254
|
-
|
|
255
|
-
* Fixed an incompatibility with the pretty formatter in certain
|
|
256
|
-
environments such as tmux.
|
|
257
|
-
* Fixed a bug where the pretty formatter would crash if the first line
|
|
258
|
-
of a test file's output was invalid TAP.
|
|
259
|
-
|
|
260
|
-
*0.3.0* (October 21, 2013)
|
|
261
|
-
|
|
262
|
-
* Improved formatting for tests run from a terminal. Failing tests
|
|
263
|
-
are now colored in red, and the total number of failing tests is
|
|
264
|
-
displayed at the end of the test run. When Bats is not connected to
|
|
265
|
-
a terminal (e.g. in CI runs), or when invoked with the `--tap` flag,
|
|
266
|
-
output is displayed in standard TAP format.
|
|
267
|
-
* Added the ability to skip tests using the `skip` command.
|
|
268
|
-
* Added a message to failing test case output indicating the file and
|
|
269
|
-
line number of the statement that caused the test to fail.
|
|
270
|
-
* Added "ad-hoc" test suite support. You can now invoke `bats` with
|
|
271
|
-
multiple filename or directory arguments to run all the specified
|
|
272
|
-
tests in aggregate.
|
|
273
|
-
* Added support for test files with Windows line endings.
|
|
274
|
-
* Fixed regular expression warnings from certain versions of Bash.
|
|
275
|
-
* Fixed a bug running tests containing lines that begin with `-e`.
|
|
276
|
-
|
|
277
|
-
*0.2.0* (November 16, 2012)
|
|
278
|
-
|
|
279
|
-
* Added test suite support. The `bats` command accepts a directory
|
|
280
|
-
name containing multiple test files to be run in aggregate.
|
|
281
|
-
* Added the ability to count the number of test cases in a file or
|
|
282
|
-
suite by passing the `-c` flag to `bats`.
|
|
283
|
-
* Preprocessed sources are cached between test case runs in the same
|
|
284
|
-
file for better performance.
|
|
285
|
-
|
|
286
|
-
*0.1.0* (December 30, 2011)
|
|
287
|
-
|
|
288
|
-
* Initial public release.
|
|
289
|
-
|
|
290
|
-
---
|
|
291
|
-
|
|
292
|
-
© 2014 Sam Stephenson. Bats is released under an MIT-style license;
|
|
293
|
-
see `LICENSE` for details.
|
|
135
|
+
[gitter]: https://gitter.im/bats-core/bats-core
|
data/vendor/bats/VERSION.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
https://github.com/
|
|
1
|
+
https://github.com/bats-core/bats-core/archive/refs/tags/v1.14.0.tar.gz
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
# Note: We first need to use POSIX's `[ ... ]' instead of Bash's `[[ ... ]]'
|
|
6
|
+
# because this is the check for Bash, where the shell may not be Bash. Once we
|
|
7
|
+
# confirm that we are in Bash, we can use [[ ... ]] and (( ... )). Note that
|
|
8
|
+
# these [[ ... ]] and (( ... )) do not cause syntax errors in POSIX shells,
|
|
9
|
+
# though they can be parsed differently.
|
|
10
|
+
if [ -z "${BASH_VERSION-}" ] ||
|
|
11
|
+
[[ -z "${BASH_VERSINFO-}" ]] ||
|
|
12
|
+
((BASH_VERSINFO[0] < 3 || (BASH_VERSINFO[0] == 3 && BASH_VERSINFO[1] < 2)))
|
|
13
|
+
then
|
|
14
|
+
printf 'bats: this program needs to be run by Bash >= 3.2\n' >&2
|
|
15
|
+
exit 1
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
if command -v greadlink >/dev/null; then
|
|
19
|
+
bats_readlinkf() {
|
|
20
|
+
greadlink -f "$1"
|
|
21
|
+
}
|
|
22
|
+
else
|
|
23
|
+
bats_readlinkf() {
|
|
24
|
+
readlink -f "$1"
|
|
25
|
+
}
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
fallback_to_readlinkf_posix() {
|
|
29
|
+
bats_readlinkf() {
|
|
30
|
+
[ "${1:-}" ] || return 1
|
|
31
|
+
max_symlinks=40
|
|
32
|
+
CDPATH='' # to avoid changing to an unexpected directory
|
|
33
|
+
|
|
34
|
+
target=$1
|
|
35
|
+
[ -e "${target%/}" ] || target=${1%"${1##*[!/]}"} # trim trailing slashes
|
|
36
|
+
[ -d "${target:-/}" ] && target="$target/"
|
|
37
|
+
|
|
38
|
+
cd -P . 2>/dev/null || return 1
|
|
39
|
+
while [ "$max_symlinks" -ge 0 ] && max_symlinks=$((max_symlinks - 1)); do
|
|
40
|
+
if [ ! "$target" = "${target%/*}" ]; then
|
|
41
|
+
case $target in
|
|
42
|
+
/*) cd -P "${target%/*}/" 2>/dev/null || break ;;
|
|
43
|
+
*) cd -P "./${target%/*}" 2>/dev/null || break ;;
|
|
44
|
+
esac
|
|
45
|
+
target=${target##*/}
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
if [ ! -L "$target" ]; then
|
|
49
|
+
target="${PWD%/}${target:+/}${target}"
|
|
50
|
+
printf '%s\n' "${target:-/}"
|
|
51
|
+
return 0
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
# `ls -dl` format: "%s %u %s %s %u %s %s -> %s\n",
|
|
55
|
+
# <file mode>, <number of links>, <owner name>, <group name>,
|
|
56
|
+
# <size>, <date and time>, <pathname of link>, <contents of link>
|
|
57
|
+
# https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html
|
|
58
|
+
link=$(ls -dl -- "$target" 2>/dev/null) || break
|
|
59
|
+
target=${link#*" $target -> "}
|
|
60
|
+
done
|
|
61
|
+
return 1
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if ! BATS_PATH=$(bats_readlinkf "${BASH_SOURCE[0]}" 2>/dev/null); then
|
|
66
|
+
fallback_to_readlinkf_posix
|
|
67
|
+
BATS_PATH=$(bats_readlinkf "${BASH_SOURCE[0]}")
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
export BATS_SAVED_PATH=$PATH
|
|
71
|
+
BATS_BASE_LIBDIR=lib # this will be patched with the true value in install.sh
|
|
72
|
+
|
|
73
|
+
export BATS_ROOT=${BATS_PATH%/*/*}
|
|
74
|
+
export -f bats_readlinkf
|
|
75
|
+
exec env BATS_ROOT="$BATS_ROOT" BATS_LIBDIR="${BATS_BASE_LIBDIR:-lib}" "$BATS_ROOT/libexec/bats-core/bats" "$@"
|
data/vendor/bats/install.sh
CHANGED
|
@@ -1,37 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
set -e
|
|
3
|
-
|
|
4
|
-
resolve_link() {
|
|
5
|
-
$(type -p greadlink readlink | head -1) "$1"
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
abs_dirname() {
|
|
9
|
-
local cwd="$(pwd)"
|
|
10
|
-
local path="$1"
|
|
11
2
|
|
|
12
|
-
|
|
13
|
-
cd "${path%/*}"
|
|
14
|
-
local name="${path##*/}"
|
|
15
|
-
path="$(resolve_link "$name" || true)"
|
|
16
|
-
done
|
|
3
|
+
set -e
|
|
17
4
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
5
|
+
BATS_ROOT="${0%/*}"
|
|
6
|
+
PREFIX="${1%/}"
|
|
7
|
+
LIBDIR="${2:-lib}"
|
|
21
8
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
9
|
+
if [[ -z "$PREFIX" ]]; then
|
|
10
|
+
printf '%s\n' \
|
|
11
|
+
"usage: $0 <prefix> [base_libdir]" \
|
|
12
|
+
" e.g. $0 /usr/local" \
|
|
13
|
+
" $0 /usr/local lib64" >&2
|
|
27
14
|
exit 1
|
|
28
15
|
fi
|
|
29
16
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
17
|
+
install -d -m 755 "$PREFIX"/{bin,libexec/bats-core,"${LIBDIR}"/bats-core,share/man/man{1,7}}
|
|
18
|
+
|
|
19
|
+
install -m 755 "$BATS_ROOT/bin"/* "$PREFIX/bin"
|
|
20
|
+
install -m 755 "$BATS_ROOT/libexec/bats-core"/* "$PREFIX/libexec/bats-core"
|
|
21
|
+
install -m 755 "$BATS_ROOT/lib/bats-core"/* "$PREFIX/${LIBDIR}/bats-core"
|
|
22
|
+
install -m 644 "$BATS_ROOT/man/bats.1" "$PREFIX/share/man/man1"
|
|
23
|
+
install -m 644 "$BATS_ROOT/man/bats.7" "$PREFIX/share/man/man7"
|
|
24
|
+
|
|
25
|
+
read -rd '' BATS_EXE_CONTENTS <"$PREFIX/bin/bats" || true
|
|
26
|
+
BATS_EXE_CONTENTS=${BATS_EXE_CONTENTS/"BATS_BASE_LIBDIR=lib"/"BATS_BASE_LIBDIR=${LIBDIR}"}
|
|
27
|
+
printf "%s" "$BATS_EXE_CONTENTS" >| "$PREFIX/bin/bats"
|
|
36
28
|
|
|
37
29
|
echo "Installed Bats to $PREFIX/bin/bats"
|