Commit graph

25 commits

Author SHA1 Message Date
0719fa33c2
Support ✓/✗ as alternatives to [success]/[failure] 2026-04-16 17:23:59 +02:00
4704cc088d
Introduce a DSL to replace the plain bash scripts
It's really important for `git-check-assertions` blocks to be 'obviously
correct', so that we don't need to... test the tests that test the tests.

Let's introduce a little DSL that is less error-prone than a plain bash
script.
2026-04-16 17:23:59 +02:00
69f8acad8f
Print block number and remove redundant commit hash 2026-03-11 23:02:38 +01:00
35584c9aa7
Restore the commit between assertion blocks
```git-check-assertions
run ./test/git-check-assertions.bats
assert_success

git checkout HEAD~ bin
run ./test/git-check-assertions.bats
assert_failure
assert_output --partial "not ok 10 should restore the commit between assertion blocks in one commit message"
```
2026-03-11 22:41:44 +01:00
7e483b8a7f
Add support for multiple git-check-assertions blocks 2026-03-11 22:41:44 +01:00
e647b2599b
Cache successful commits
```git-check-assertions
run test/git-check-assertions.bats
assert_success

git checkout HEAD~1 bin
run test/git-check-assertions.bats
assert_failure
assert_output --partial "file exists, but it was expected to be absent"
```
2026-03-10 06:49:23 +01:00
fea90637e3
Print a message when all went well 2026-03-06 17:50:28 +01:00
495f6757dd
Make 'run' print the command output
```git-check-assertions
run test/git-check-assertions.bats
assert_success

git checkout HEAD~1 bin
run test/git-check-assertions.bats
assert_failure
```
2026-03-06 05:21:50 +01:00
a31bc62046
Check initial state before running
```git-check-assertions
run test/git-check-assertions.bats
assert_success

git checkout HEAD~1 bin
run test/git-check-assertions.bats
assert_failure
assert_output --partial "not ok 2 should refuse to run when the index has changes"
assert_output --partial "not ok 3 should refuse to run when the working tree has changes"
assert_output --partial "not ok 4 should refuse to run when there are untracked files"
```
2026-03-06 05:12:00 +01:00
1ec02587b0
Demonstrate that the index isn't restored
```git-check-assertions
run ./test/git-check-assertions.bats
assert_failure
assert_output --partial "not ok 9 should restore index when finished"
assert_output --partial "not ok 10 should restore index between commits"
assert_output --partial "not ok 11 should restore index after a failure"
assert_output --partial "not ok 13 you can use git checkout in an assertion to assert against a mixed version of the code"
```
2026-03-06 04:44:32 +01:00
e495aa826e
Add a failing test to show that master isn't supported
```git-check-assertions
run ./test/git-check-assertions.bats
assert_failure
assert_output --partial "fatal: Not a valid object name main"
```
2026-03-04 07:57:12 +01:00
99bcd7460f
Add failing test to check if the worktree is restored after failure
This test currently doesn't pass:

```git-check-assertions
run ./test/git-check-assertions.bats
assert_failure
assert_output --partial "file is greater than 0 byte"
```
2026-03-04 07:38:06 +01:00
d8e758387c
Add partial change example
```git-check-assertions
sed -i 's/HEAD~/HEAD/' test/git-check-assertions.bats
run test/git-check-assertions.bats
assert_failure
assert_output --partial "Expected command to fail, but it succeeded."
```
2026-03-04 07:27:46 +01:00
3036d6d37e
Introduce --partial on assert_output 2026-03-03 20:29:39 +01:00
475b0c6fa1
Verify that stderr is taken into account 2026-03-03 20:28:17 +01:00
b57d527d6e
Introduce assert_output 2026-03-03 20:26:07 +01:00
f9d6696687
Introduce assert_failure 2026-03-03 20:23:39 +01:00
1a10b24b06
Introduce assert_success 2026-03-03 20:22:34 +01:00
e9c8e3b35e
Use bats.withLibraries instead of submodules 2026-03-03 07:16:29 +01:00
f4cdb276c3
Add some initial tests 2026-03-03 07:16:29 +01:00
5dbb6aea8f
Set up shfmt 2026-03-03 07:16:29 +01:00
769d7da9b2
Use git init to immediately create the correct branch 2026-03-03 07:16:28 +01:00
f5f05c0a9e
Set up the git repository in the bats file instead 2026-03-03 07:16:28 +01:00
e48e27fb52
Add helper modules for bats
According to these instructions:
https://bats-core.readthedocs.io/en/stable/tutorial.html#quick-installation
2026-03-03 07:16:28 +01:00
653a1b67bc
Move test.bats to test/git-check-assertions.bats 2026-03-03 07:16:28 +01:00
Renamed from test.bats (Browse further)