Skip to content

Commit

Permalink
Add coverage for Fatalf, FailNow and SkipNow (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
prashantv authored Jan 14, 2025
1 parent be14d28 commit ae1123c
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 73 deletions.
27 changes: 25 additions & 2 deletions integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ func TestCmp_SkipThenFail(t *testing.T) {
func TestCmp_Fatal(t *testing.T) {
cmptest.Compare(t, func(t testing.TB) {
t.Log("pre-fatal")
//nolint:revive // skip unreachable skip
t.Fatal("fatal")
t.Fatal("fatal") //nolint:revive // skip unreachable skip
t.Log("post-fatal")
})
}
Expand Down Expand Up @@ -317,3 +316,27 @@ func TestCmp_TmpDir(t *testing.T) {
listFiles("d2 after create", d2)
})
}

func TestCmp_Fatalf(t *testing.T) {
cmptest.Compare(t, func(t testing.TB) {
t.Error("pre-fail log")
t.Fatalf("log: %v", "fatal") //nolint:revive // skip unreachable skip
t.Error("post-fail log")
})
}

func TestCmp_FailNow(t *testing.T) {
cmptest.Compare(t, func(t testing.TB) {
t.Error("pre-fail log")
t.FailNow() //nolint:revive // skip unreachable skip
t.Error("post-fail log")
})
}

func TestCmp_SkipNow(t *testing.T) {
cmptest.Compare(t, func(t testing.TB) {
t.Error("pre-skip log")
t.SkipNow()
t.Error("post-skip log")
})
}
Loading

0 comments on commit ae1123c

Please sign in to comment.