Add helper modules for bats
According to these instructions: https://bats-core.readthedocs.io/en/stable/tutorial.html#quick-installation
This commit is contained in:
parent
653a1b67bc
commit
e48e27fb52
7 changed files with 25 additions and 3 deletions
9
.gitmodules
vendored
Normal file
9
.gitmodules
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
[submodule "test/test_helper/bats-support"]
|
||||||
|
path = test/test_helper/bats-support
|
||||||
|
url = https://github.com/bats-core/bats-support.git
|
||||||
|
[submodule "test/test_helper/bats-assert"]
|
||||||
|
path = test/test_helper/bats-assert
|
||||||
|
url = https://github.com/bats-core/bats-assert.git
|
||||||
|
[submodule "test/test_helper/bats-file"]
|
||||||
|
path = test/test_helper/bats-file
|
||||||
|
url = https://github.com/bats-core/bats-file.git
|
||||||
|
|
@ -13,6 +13,12 @@ You include a small bash script inside your commit messages, and `git-check-asse
|
||||||
|
|
||||||
⚠️ Only run this on repositories and branches that you trust, since the `bash` scripts in the commit messages can do whatever they want.
|
⚠️ Only run this on repositories and branches that you trust, since the `bash` scripts in the commit messages can do whatever they want.
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nix build .?submodules=1
|
||||||
|
```
|
||||||
|
|
||||||
## Examples of commit messages
|
## Examples of commit messages
|
||||||
|
|
||||||
Assert that a commit builds:
|
Assert that a commit builds:
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ resholve.mkDerivation {
|
||||||
src = fs.toSource {
|
src = fs.toSource {
|
||||||
root = ./.;
|
root = ./.;
|
||||||
fileset = fs.unions [
|
fileset = fs.unions [
|
||||||
./bin/git-check-assertions
|
./bin
|
||||||
./test/git-check-assertions.bats
|
./test
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,14 @@
|
||||||
#!/usr/bin/env bats
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
|
load 'test_helper/bats-support/load'
|
||||||
|
load 'test_helper/bats-assert/load'
|
||||||
|
|
||||||
DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )"
|
DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )"
|
||||||
PATH="$DIR/../bin:$PATH"
|
PATH="$DIR/../bin:$PATH"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "can run" {
|
@test "can run" {
|
||||||
git-check-assertions
|
run git-check-assertions
|
||||||
|
assert_success
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1
test/test_helper/bats-assert
Submodule
1
test/test_helper/bats-assert
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 697471b7a89d3ab38571f38c6c7c4b460d1f5e35
|
||||||
1
test/test_helper/bats-file
Submodule
1
test/test_helper/bats-file
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 6bee58bec7c2f4aed1a7425ccd4bdc42b4a84599
|
||||||
1
test/test_helper/bats-support
Submodule
1
test/test_helper/bats-support
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 0954abb9925cad550424cebca2b99255d4eabe96
|
||||||
Loading…
Add table
Add a link
Reference in a new issue