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" ```
This commit is contained in:
parent
d4d25dd784
commit
1ec02587b0
1 changed files with 32 additions and 0 deletions
|
|
@ -129,6 +129,37 @@ commit_with_assertion() {
|
||||||
assert_size_zero readme
|
assert_size_zero readme
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "should restore index when finished" {
|
||||||
|
git checkout -b feature
|
||||||
|
commit_with_assertion $'echo blah >> readme\ngit add readme'
|
||||||
|
|
||||||
|
run git-check-assertions
|
||||||
|
|
||||||
|
assert_success
|
||||||
|
assert_size_zero readme
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "should restore index between commits" {
|
||||||
|
git checkout -b feature
|
||||||
|
commit_with_assertion $'echo blah >> readme\ngit add readme'
|
||||||
|
commit_with_assertion 'cp readme ../test'
|
||||||
|
|
||||||
|
run git-check-assertions
|
||||||
|
|
||||||
|
assert_success
|
||||||
|
assert_size_zero ../test
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "should restore index after a failure" {
|
||||||
|
git checkout -b feature
|
||||||
|
commit_with_assertion $'echo blah >> readme\ngit add readme\nexit 3'
|
||||||
|
|
||||||
|
run git-check-assertions
|
||||||
|
|
||||||
|
assert_failure
|
||||||
|
assert_size_zero readme
|
||||||
|
}
|
||||||
|
|
||||||
@test "assertions should run against the version of the code inside of the commit" {
|
@test "assertions should run against the version of the code inside of the commit" {
|
||||||
git checkout -b feature
|
git checkout -b feature
|
||||||
echo commit1 >readme
|
echo commit1 >readme
|
||||||
|
|
@ -157,6 +188,7 @@ commit_with_assertion() {
|
||||||
run git-check-assertions
|
run git-check-assertions
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
|
assert_file_contains src goodbye
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "assert_success should succeed if the executed command succeeded" {
|
@test "assert_success should succeed if the executed command succeeded" {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue