Support ✓/✗ as alternatives to [success]/[failure]

This commit is contained in:
Sven van Heugten 2026-04-16 17:01:40 +02:00
parent 4704cc088d
commit 0719fa33c2
No known key found for this signature in database
GPG key ID: D612F88666F4F660
3 changed files with 49 additions and 21 deletions

View file

@ -60,18 +60,18 @@ Simply add a `git-check-assertions` block to a commit message, e.g.:
~~~
```git-check-assertions
[success] dotnet build
[success] dotnet test --no-build
dotnet build
dotnet test --no-build
```
~~~
Each block is parsed line-by-line:
* A line starting with `[success] ` runs the rest of the line as a shell command and asserts that it exits with status `0`.
* A line starting with `[failure] ` runs the rest of the line as a shell command and asserts that it exits with a non-zero status.
* A line starting with `[success] ` or `✓ ` runs the rest of the line as a shell command and asserts that it exits with status `0`.
* A line starting with `[failure] ` or `✗ ` runs the rest of the line as a shell command and asserts that it exits with a non-zero status.
* Any following non-empty line belongs to the most recent command and asserts that the combined stdout/stderr from that command contains that string.
Blank lines are ignored. A new `[success]` or `[failure]` line starts a new command block.
Blank lines are ignored. A new `[success]`, `[failure]`, `✓`, or `✗` line starts a new command block.
## Multiple blocks in one commit message
@ -89,7 +89,7 @@ Assert that a commit builds:
~~~
```git-check-assertions
[success] dotnet build
dotnet build
```
~~~
@ -97,8 +97,8 @@ Assert that a commit builds and that the tests succeed:
~~~
```git-check-assertions
[success] dotnet build
[success] dotnet test --no-build
dotnet build
dotnet test --no-build
```
~~~
@ -106,8 +106,8 @@ Assert that a commit builds, but that the tests do not succeed:
~~~
```git-check-assertions
[success] dotnet build
[failure] dotnet test --no-build
dotnet build
dotnet test --no-build
```
~~~
@ -115,8 +115,8 @@ Assert that a commit builds, and that the tests fail with the error that you exp
~~~
```git-check-assertions
[success] dotnet build
[failure] dotnet test --no-build
dotnet build
dotnet test --no-build
Invalid URL
```
~~~
@ -125,10 +125,10 @@ Assert that a specific change breaks the tests (as discussed [here](https://sven
~~~
```git-check-assertions
[success] dotnet test
dotnet test
[success] sed -i '/crucial code/d' Main.fs
[failure] dotnet test
sed -i '/crucial code/d' Main.fs
dotnet test
```
~~~
@ -136,10 +136,10 @@ Assert that a specific change in a commit is necessary for the tests to succeed:
~~~
```git-check-assertions
[success] dotnet test
dotnet test
[success] git checkout HEAD~ Main.fs
[failure] dotnet test
git checkout HEAD~ Main.fs
dotnet test
Invalid URL
```
~~~