Merge pull request 'Add partial change example' (#7) from add-partial-change-example into main
Reviewed-on: https://codeberg.org/svenvanheugten/git-check-assertions/pulls/7
This commit is contained in:
commit
6963d06363
2 changed files with 27 additions and 0 deletions
11
README.md
11
README.md
|
|
@ -125,3 +125,14 @@ run dotnet test --no-build
|
||||||
assert_failure
|
assert_failure
|
||||||
```
|
```
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
|
Assert that a specific change in a commit is necessary for the tests to succeed:
|
||||||
|
|
||||||
|
~~~
|
||||||
|
```git-check-assertions
|
||||||
|
git checkout HEAD~ Main.fs
|
||||||
|
run dotnet test
|
||||||
|
assert_failure
|
||||||
|
assert_output --partial "Invalid URL"
|
||||||
|
```
|
||||||
|
~~~
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,22 @@ commit_with_assertion() {
|
||||||
assert_success
|
assert_success
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "you can use git checkout in an assertion to assert against a mixed version of the code" {
|
||||||
|
git checkout -b feature
|
||||||
|
echo hello >src
|
||||||
|
echo 'grep hello src' >tests
|
||||||
|
git add src tests
|
||||||
|
git commit -m 'add src and tests'
|
||||||
|
echo goodbye >src
|
||||||
|
echo 'grep goodbye src' >tests
|
||||||
|
git add src tests
|
||||||
|
commit_with_assertion $'git checkout HEAD~ src\nrun bash tests\nassert_failure'
|
||||||
|
|
||||||
|
run git-check-assertions
|
||||||
|
|
||||||
|
assert_success
|
||||||
|
}
|
||||||
|
|
||||||
@test "assert_success should succeed if the executed command succeeded" {
|
@test "assert_success should succeed if the executed command succeeded" {
|
||||||
git checkout -b feature
|
git checkout -b feature
|
||||||
commit_with_assertion $'run exit 0\nassert_success'
|
commit_with_assertion $'run exit 0\nassert_success'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue