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:
Sven van Heugten 2026-03-02 20:06:53 +01:00
parent 653a1b67bc
commit e48e27fb52
No known key found for this signature in database
GPG key ID: D612F88666F4F660
7 changed files with 25 additions and 3 deletions

9
.gitmodules vendored Normal file
View 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

View file

@ -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.
## Building
```bash
nix build .?submodules=1
```
## Examples of commit messages
Assert that a commit builds:

View file

@ -20,8 +20,8 @@ resholve.mkDerivation {
src = fs.toSource {
root = ./.;
fileset = fs.unions [
./bin/git-check-assertions
./test/git-check-assertions.bats
./bin
./test
];
};

View file

@ -1,10 +1,14 @@
#!/usr/bin/env bats
setup() {
load 'test_helper/bats-support/load'
load 'test_helper/bats-assert/load'
DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )"
PATH="$DIR/../bin:$PATH"
}
@test "can run" {
git-check-assertions
run git-check-assertions
assert_success
}

@ -0,0 +1 @@
Subproject commit 697471b7a89d3ab38571f38c6c7c4b460d1f5e35

@ -0,0 +1 @@
Subproject commit 6bee58bec7c2f4aed1a7425ccd4bdc42b4a84599

@ -0,0 +1 @@
Subproject commit 0954abb9925cad550424cebca2b99255d4eabe96