Skip to content

Commit

Permalink
Increase test coverage.
Browse files Browse the repository at this point in the history
Fix possible problem with verificationsWriter set as nil.
  • Loading branch information
storozhukBM committed Aug 3, 2018
1 parent 52a76f6 commit bab047b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func printWarningOnUncheckedVerification(v *Verify) {
return
}
rawWriter := verificationsWriter.Load()
if rawWriter == nil {
if rawWriter == nil || rawWriter.(writerWrapper).value == nil {
rawWriter = writerWrapper{os.Stdout}
}
writer := rawWriter.(writerWrapper).value
Expand Down
6 changes: 6 additions & 0 deletions verifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ func TestVerifier_negative_unhandled_success(t *testing.T) {
if !strings.HasPrefix(resultBuffer, "[ERROR] found unhandled verification: verification success") {
t.Fatalf("unexpected verifier buffer: %s", resultBuffer)
}
verifier.SetUnhandledVerificationsWriter(nil)

verify = verifier.New()
verify.That(true, "empty string is not nil")
runtime.GC()
time.Sleep(10 * time.Millisecond)
}

func TestVerifier_negative_silent(t *testing.T) {
Expand Down

0 comments on commit bab047b

Please sign in to comment.