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" ```
This commit is contained in:
parent
3ce1ea5e4b
commit
a31bc62046
2 changed files with 32 additions and 0 deletions
|
|
@ -46,6 +46,34 @@ commit_with_assertion() {
|
|||
assert_file_not_exists ../test
|
||||
}
|
||||
|
||||
@test "should refuse to run when the index has changes" {
|
||||
echo "staged" >>readme
|
||||
git add readme
|
||||
|
||||
run git-check-assertions
|
||||
|
||||
assert_failure
|
||||
assert_output --partial "Uncommitted changes. Refusing to run."
|
||||
}
|
||||
|
||||
@test "should refuse to run when the working tree has changes" {
|
||||
echo "unstaged" >>readme
|
||||
|
||||
run git-check-assertions
|
||||
|
||||
assert_failure
|
||||
assert_output --partial "Uncommitted changes. Refusing to run."
|
||||
}
|
||||
|
||||
@test "should refuse to run when there are untracked files" {
|
||||
echo "new" >untracked
|
||||
|
||||
run git-check-assertions
|
||||
|
||||
assert_failure
|
||||
assert_output --partial "Uncommitted changes. Refusing to run."
|
||||
}
|
||||
|
||||
@test "should not run any assertion blocks from main when on a feature branch" {
|
||||
commit_with_assertion "touch ../test"
|
||||
git checkout -b feature
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue