gabr 2.0.13 → 2.1.1
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.
- package/Makefile +0 -0
- package/README.md +59 -64
- package/bin/bats-exec-suite +20 -9
- package/bin/bats-exec-test +22 -19
- package/bin/bats-format-tap-stream +7 -0
- package/example/GIT.md +35 -3
- package/example/IFS.sh +3 -0
- package/example/clang.c +17 -0
- package/example/git.sh +16 -18
- package/example/npm.sh +15 -6
- package/example/usage.sh +18 -17
- package/gabr.linux.sh +34 -23
- package/gabr.sh +30 -26
- package/package.json +3 -4
- package/say.sh +10 -0
- package/start/start.sh +11 -0
- package/test/gabr.bats +25 -11
- package/usage.sh +1 -5
- package/modules/bats-core/LICENSE.md +0 -53
- package/modules/bats-core/README.md +0 -530
- package/modules/bats-core/bin/bats +0 -44
- package/modules/bats-core/libexec/bats-core/bats +0 -171
- package/modules/bats-core/libexec/bats-core/bats-exec-suite +0 -101
- package/modules/bats-core/libexec/bats-core/bats-exec-test +0 -373
- package/modules/bats-core/libexec/bats-core/bats-format-tap-stream +0 -174
- package/modules/bats-core/libexec/bats-core/bats-preprocess +0 -58
- package/modules/bats-core/man/Makefile +0 -10
- package/modules/bats-core/man/README.md +0 -5
- package/modules/bats-core/man/bats.1 +0 -115
- package/modules/bats-core/man/bats.1.ronn +0 -115
- package/modules/bats-core/man/bats.7 +0 -178
- package/modules/bats-core/man/bats.7.ronn +0 -156
- package/modules/shdoc/LICENSE +0 -21
- package/modules/shdoc/README.md +0 -93
- package/modules/shdoc/shdoc +0 -174
- /package/example/{javascript → javascript.js} +0 -0
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
bats(7) -- Bats test file format
|
|
2
|
-
================================
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
DESCRIPTION
|
|
6
|
-
-----------
|
|
7
|
-
|
|
8
|
-
A Bats test file is a Bash script with special syntax for defining
|
|
9
|
-
test cases. Under the hood, each test case is just a function with a
|
|
10
|
-
description.
|
|
11
|
-
|
|
12
|
-
#!/usr/bin/env bats
|
|
13
|
-
|
|
14
|
-
@test "addition using bc" {
|
|
15
|
-
result="$(echo 2+2 | bc)"
|
|
16
|
-
[ "$result" -eq 4 ]
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@test "addition using dc" {
|
|
20
|
-
result="$(echo 2 2+p | dc)"
|
|
21
|
-
[ "$result" -eq 4 ]
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Each Bats test file is evaluated n+1 times, where _n_ is the number of
|
|
26
|
-
test cases in the file. The first run counts the number of test cases,
|
|
27
|
-
then iterates over the test cases and executes each one in its own
|
|
28
|
-
process.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
THE RUN HELPER
|
|
32
|
-
--------------
|
|
33
|
-
|
|
34
|
-
Many Bats tests need to run a command and then make assertions about
|
|
35
|
-
its exit status and output. Bats includes a `run` helper that invokes
|
|
36
|
-
its arguments as a command, saves the exit status and output into
|
|
37
|
-
special global variables, and then returns with a `0` status code so
|
|
38
|
-
you can continue to make assertions in your test case.
|
|
39
|
-
|
|
40
|
-
For example, let's say you're testing that the `foo` command, when
|
|
41
|
-
passed a nonexistent filename, exits with a `1` status code and prints
|
|
42
|
-
an error message.
|
|
43
|
-
|
|
44
|
-
@test "invoking foo with a nonexistent file prints an error" {
|
|
45
|
-
run foo nonexistent_filename
|
|
46
|
-
[ "$status" -eq 1 ]
|
|
47
|
-
[ "$output" = "foo: no such file 'nonexistent_filename'" ]
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
The `$status` variable contains the status code of the command, and
|
|
51
|
-
the `$output` variable contains the combined contents of the command's
|
|
52
|
-
standard output and standard error streams.
|
|
53
|
-
|
|
54
|
-
A third special variable, the `$lines` array, is available for easily
|
|
55
|
-
accessing individual lines of output. For example, if you want to test
|
|
56
|
-
that invoking `foo` without any arguments prints usage information on
|
|
57
|
-
the first line:
|
|
58
|
-
|
|
59
|
-
@test "invoking foo without arguments prints usage" {
|
|
60
|
-
run foo
|
|
61
|
-
[ "$status" -eq 1 ]
|
|
62
|
-
[ "${lines[0]}" = "usage: foo <filename>" ]
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
THE LOAD COMMAND
|
|
67
|
-
----------------
|
|
68
|
-
|
|
69
|
-
You may want to share common code across multiple test files. Bats
|
|
70
|
-
includes a convenient `load` command for sourcing a Bash source file
|
|
71
|
-
relative to the location of the current test file. For example, if you
|
|
72
|
-
have a Bats test in `test/foo.bats`, the command
|
|
73
|
-
|
|
74
|
-
load test_helper
|
|
75
|
-
|
|
76
|
-
will source the script `test/test_helper.bash` in your test file. This
|
|
77
|
-
can be useful for sharing functions to set up your environment or load
|
|
78
|
-
fixtures.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
THE SKIP COMMAND
|
|
82
|
-
----------------
|
|
83
|
-
|
|
84
|
-
Tests can be skipped by using the `skip` command at the point in a
|
|
85
|
-
test you wish to skip.
|
|
86
|
-
|
|
87
|
-
@test "A test I don't want to execute for now" {
|
|
88
|
-
skip
|
|
89
|
-
run foo
|
|
90
|
-
[ "$status" -eq 0 ]
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
Optionally, you may include a reason for skipping:
|
|
94
|
-
|
|
95
|
-
@test "A test I don't want to execute for now" {
|
|
96
|
-
skip "This command will return zero soon, but not now"
|
|
97
|
-
run foo
|
|
98
|
-
[ "$status" -eq 0 ]
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
Or you can skip conditionally:
|
|
102
|
-
|
|
103
|
-
@test "A test which should run" {
|
|
104
|
-
if [ foo != bar ]; then
|
|
105
|
-
skip "foo isn't bar"
|
|
106
|
-
fi
|
|
107
|
-
|
|
108
|
-
run foo
|
|
109
|
-
[ "$status" -eq 0 ]
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
SETUP AND TEARDOWN FUNCTIONS
|
|
114
|
-
----------------------------
|
|
115
|
-
|
|
116
|
-
You can define special `setup` and `teardown` functions which run
|
|
117
|
-
before and after each test case, respectively. Use these to load
|
|
118
|
-
fixtures, set up your environment, and clean up when you're done.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
CODE OUTSIDE OF TEST CASES
|
|
122
|
-
--------------------------
|
|
123
|
-
|
|
124
|
-
You can include code in your test file outside of `@test` functions.
|
|
125
|
-
For example, this may be useful if you want to check for dependencies
|
|
126
|
-
and fail immediately if they're not present. However, any output that
|
|
127
|
-
you print in code outside of `@test`, `setup` or `teardown` functions
|
|
128
|
-
must be redirected to `stderr` (`>&2`). Otherwise, the output may
|
|
129
|
-
cause Bats to fail by polluting the TAP stream on `stdout`.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
SPECIAL VARIABLES
|
|
133
|
-
-----------------
|
|
134
|
-
|
|
135
|
-
There are several global variables you can use to introspect on Bats
|
|
136
|
-
tests:
|
|
137
|
-
|
|
138
|
-
* `$BATS_TEST_FILENAME` is the fully expanded path to the Bats test
|
|
139
|
-
file.
|
|
140
|
-
* `$BATS_TEST_DIRNAME` is the directory in which the Bats test file is
|
|
141
|
-
located.
|
|
142
|
-
* `$BATS_TEST_NAMES` is an array of function names for each test case.
|
|
143
|
-
* `$BATS_TEST_NAME` is the name of the function containing the current
|
|
144
|
-
test case.
|
|
145
|
-
* `$BATS_TEST_DESCRIPTION` is the description of the current test
|
|
146
|
-
case.
|
|
147
|
-
* `$BATS_TEST_NUMBER` is the (1-based) index of the current test case
|
|
148
|
-
in the test file.
|
|
149
|
-
* `$BATS_TMPDIR` is the location to a directory that may be used to
|
|
150
|
-
store temporary files.
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
SEE ALSO
|
|
154
|
-
--------
|
|
155
|
-
|
|
156
|
-
`bash`(1), `bats`(1)
|
package/modules/shdoc/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2017 Stanislav Seletskiy
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/modules/shdoc/README.md
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
# shdoc
|
|
2
|
-
|
|
3
|
-
Converts comments to function to reference markdown documentation.
|
|
4
|
-
|
|
5
|
-
# Usage
|
|
6
|
-
|
|
7
|
-
## Global Script tags
|
|
8
|
-
|
|
9
|
-
shdoc will match comments in the following form on top of a script file:
|
|
10
|
-
```sh
|
|
11
|
-
#!/bin/bash
|
|
12
|
-
#
|
|
13
|
-
# @file Title of file script
|
|
14
|
-
# @brief Small description of the script.
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Will produce following output:
|
|
18
|
-
|
|
19
|
-
# Title of file script
|
|
20
|
-
|
|
21
|
-
Small description of the script.
|
|
22
|
-
|
|
23
|
-
## Function tags
|
|
24
|
-
|
|
25
|
-
shdoc will match comments in the following form before function definitions:
|
|
26
|
-
|
|
27
|
-
```sh
|
|
28
|
-
# @description Multiline description goes here and
|
|
29
|
-
# there
|
|
30
|
-
#
|
|
31
|
-
# @example
|
|
32
|
-
# some:other:func a b c
|
|
33
|
-
# echo 123
|
|
34
|
-
#
|
|
35
|
-
# @arg $1 string Some arg.
|
|
36
|
-
# @arg $@ any Rest of arguments.
|
|
37
|
-
#
|
|
38
|
-
# @noargs
|
|
39
|
-
#
|
|
40
|
-
# @exitcode 0 If successfull.
|
|
41
|
-
# @exitcode >0 On failure
|
|
42
|
-
# @exitcode 5 On some error.
|
|
43
|
-
#
|
|
44
|
-
# @stdout Path to something.
|
|
45
|
-
#
|
|
46
|
-
# @see some:other:func()
|
|
47
|
-
some:first:func() {
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
`shdoc.awk` has no args and expects shell script with comments as described
|
|
51
|
-
above on the stdin and will markdown output result on the stdout.
|
|
52
|
-
|
|
53
|
-
Will produce following output:
|
|
54
|
-
|
|
55
|
-
## some:first:func()
|
|
56
|
-
|
|
57
|
-
Multiline description goes here and
|
|
58
|
-
there
|
|
59
|
-
|
|
60
|
-
#### Example
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
some:other:func a b c
|
|
64
|
-
echo 123
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### Arguments
|
|
68
|
-
|
|
69
|
-
* **$1** (string): Some arg.
|
|
70
|
-
* **...** (any): Rest of arguments.
|
|
71
|
-
|
|
72
|
-
_Function has no arguments._
|
|
73
|
-
|
|
74
|
-
### Exit codes
|
|
75
|
-
|
|
76
|
-
* **0**: If successfull.
|
|
77
|
-
* >**0**: On failure
|
|
78
|
-
* **5**: On some error.
|
|
79
|
-
|
|
80
|
-
### Output on stdout
|
|
81
|
-
|
|
82
|
-
* Path to something.
|
|
83
|
-
|
|
84
|
-
#### See also
|
|
85
|
-
|
|
86
|
-
* [some:other:func()](#some:other:func())
|
|
87
|
-
|
|
88
|
-
# Examples
|
|
89
|
-
|
|
90
|
-
See example documentation on:
|
|
91
|
-
|
|
92
|
-
* [tests.sh](https://github.com/reconquest/tests.sh/blob/master/REFERENCE.md)
|
|
93
|
-
* [coproc.bash](https://github.com/reconquest/coproc.bash/blob/master/REFERENCE.md)
|
package/modules/shdoc/shdoc
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/awk -f
|
|
2
|
-
|
|
3
|
-
BEGIN {
|
|
4
|
-
if (! style) {
|
|
5
|
-
style = "github"
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
styles["github", "h1", "from"] = ".*"
|
|
9
|
-
styles["github", "h1", "to"] = "# &"
|
|
10
|
-
|
|
11
|
-
styles["github", "h2", "from"] = ".*"
|
|
12
|
-
styles["github", "h2", "to"] = "## &"
|
|
13
|
-
|
|
14
|
-
styles["github", "h3", "from"] = ".*"
|
|
15
|
-
styles["github", "h3", "to"] = "### &"
|
|
16
|
-
|
|
17
|
-
styles["github", "code", "from"] = ".*"
|
|
18
|
-
styles["github", "code", "to"] = "```&"
|
|
19
|
-
|
|
20
|
-
styles["github", "/code", "to"] = "```"
|
|
21
|
-
|
|
22
|
-
styles["github", "argN", "from"] = "^(\\$[0-9]) (\\S+)"
|
|
23
|
-
styles["github", "argN", "to"] = "**\\1** (\\2):"
|
|
24
|
-
|
|
25
|
-
styles["github", "arg@", "from"] = "^\\$@ (\\S+)"
|
|
26
|
-
styles["github", "arg@", "to"] = "**...** (\\1):"
|
|
27
|
-
|
|
28
|
-
styles["github", "li", "from"] = ".*"
|
|
29
|
-
styles["github", "li", "to"] = "* &"
|
|
30
|
-
|
|
31
|
-
styles["github", "i", "from"] = ".*"
|
|
32
|
-
styles["github", "i", "to"] = "_&_"
|
|
33
|
-
|
|
34
|
-
styles["github", "anchor", "from"] = ".*"
|
|
35
|
-
styles["github", "anchor", "to"] = "[&](#&)"
|
|
36
|
-
|
|
37
|
-
styles["github", "exitcode", "from"] = "([>!]?[0-9]{1,3}) (.*)"
|
|
38
|
-
styles["github", "exitcode", "to"] = "**\\1**: \\2"
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function render(type, text) {
|
|
42
|
-
return gensub( \
|
|
43
|
-
styles[style, type, "from"],
|
|
44
|
-
styles[style, type, "to"],
|
|
45
|
-
"g",
|
|
46
|
-
text \
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/^[[:space:]]*# @file/ {
|
|
51
|
-
sub(/^[[:space:]]*# @file /, "")
|
|
52
|
-
filedoc = render("h1", $1) "\n"
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/^[[:space:]]*# @brief/ {
|
|
56
|
-
sub(/^[[:space:]]*# @brief /, "")
|
|
57
|
-
filedoc = filedoc "\n" $0
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/^[[:space:]]*# @description/ {
|
|
61
|
-
in_description = 1
|
|
62
|
-
in_example = 0
|
|
63
|
-
|
|
64
|
-
has_example = 0
|
|
65
|
-
has_args = 0
|
|
66
|
-
has_exitcode = 0
|
|
67
|
-
has_stdout = 0
|
|
68
|
-
|
|
69
|
-
docblock = ""
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
in_description {
|
|
73
|
-
if (/^[^[[:space:]]*#]|^[[:space:]]*# @[^d]/) {
|
|
74
|
-
in_description = 0
|
|
75
|
-
} else {
|
|
76
|
-
sub(/^[[:space:]]*# @description /, "")
|
|
77
|
-
sub(/^[[:space:]]*# /, "")
|
|
78
|
-
sub(/^[[:space:]]*#$/, "")
|
|
79
|
-
|
|
80
|
-
docblock = docblock "\n" $0
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
in_example {
|
|
85
|
-
if (! /^[[:space:]]*#[ ]{3}/) {
|
|
86
|
-
in_example = 0
|
|
87
|
-
|
|
88
|
-
docblock = docblock "\n" render("/code") "\n"
|
|
89
|
-
} else {
|
|
90
|
-
sub(/^[[:space:]]*#[ ]{3}/, "")
|
|
91
|
-
|
|
92
|
-
docblock = docblock "\n" $0
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/^[[:space:]]*# @example/ {
|
|
97
|
-
in_example = 1
|
|
98
|
-
|
|
99
|
-
docblock = docblock "\n" render("h3", "Example")
|
|
100
|
-
docblock = docblock "\n\n" render("code", "bash")
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/^[[:space:]]*# @arg/ {
|
|
104
|
-
if (!has_args) {
|
|
105
|
-
has_args = 1
|
|
106
|
-
|
|
107
|
-
docblock = docblock "\n" render("h3", "Arguments") "\n\n"
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
sub(/^[[:space:]]*# @arg /, "")
|
|
111
|
-
|
|
112
|
-
$0 = render("argN", $0)
|
|
113
|
-
$0 = render("arg@", $0)
|
|
114
|
-
|
|
115
|
-
docblock = docblock render("li", $0) "\n"
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/^[[:space:]]*# @noargs/ {
|
|
119
|
-
docblock = docblock "\n" render("i", "Function has no arguments.") "\n"
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/^[[:space:]]*# @exitcode/ {
|
|
123
|
-
if (!has_exitcode) {
|
|
124
|
-
has_exitcode = 1
|
|
125
|
-
|
|
126
|
-
docblock = docblock "\n" render("h3", "Exit codes") "\n\n"
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
sub(/^[[:space:]]*# @exitcode /, "")
|
|
130
|
-
|
|
131
|
-
$0 = render("exitcode", $0)
|
|
132
|
-
|
|
133
|
-
docblock = docblock render("li", $0) "\n"
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/^[[:space:]]*# @see/ {
|
|
137
|
-
sub(/[[:space:]]*# @see /, "")
|
|
138
|
-
|
|
139
|
-
$0 = render("anchor", $0)
|
|
140
|
-
$0 = render("li", $0)
|
|
141
|
-
|
|
142
|
-
docblock = docblock "\n" render("h4", "See also") "\n\n" $0 "\n"
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/^[[:space:]]*# @stdout/ {
|
|
146
|
-
has_stdout = 1
|
|
147
|
-
|
|
148
|
-
sub(/^[[:space:]]*# @stdout /, "")
|
|
149
|
-
|
|
150
|
-
docblock = docblock "\n" render("h3", "Output on stdout")
|
|
151
|
-
docblock = docblock "\n\n" render("li", $0) "\n"
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/^[[:space:]]*(function )?[[:space:]]*([a-zA-Z0-9_:.-]+)(\(\))? \{/ && docblock != "" {
|
|
155
|
-
sub(/^[[:space:]]*function /, "")
|
|
156
|
-
|
|
157
|
-
doc = doc "\n" render("h2", $1) "\n" docblock
|
|
158
|
-
|
|
159
|
-
url = $1
|
|
160
|
-
gsub(/\W/, "", url)
|
|
161
|
-
|
|
162
|
-
toc = toc "\n" "* [" $1 "](#" url ")"
|
|
163
|
-
|
|
164
|
-
docblock = ""
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
END {
|
|
168
|
-
if (filedoc != "") {
|
|
169
|
-
print filedoc
|
|
170
|
-
}
|
|
171
|
-
print toc
|
|
172
|
-
print ""
|
|
173
|
-
print doc
|
|
174
|
-
}
|
|
File without changes
|