Skip to content

Commit

Permalink
Refactor error assertion in S/MIME signing test
Browse files Browse the repository at this point in the history
Updated the test to check if the error message contains the expected substring instead of requiring an exact match. This makes the test more resilient to minor changes in error formatting.
  • Loading branch information
wneessen committed Jan 12, 2025
1 parent 7edbb75 commit ab6fc60
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions msg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5934,9 +5934,9 @@ func TestMsg_WriteTo(t *testing.T) {
if err == nil {
t.Error("expected WriteTo with invalid S/MIME private key to fail")
}
expErr := "failed to read from rand.Reader: broken reader"
if !strings.EqualFold(err.Error(), expErr) {
t.Errorf("expected S/MIME signing error to be: %s, got: %s", expErr, err)
expErr := "broken reader"
if !strings.Contains(err.Error(), expErr) {
t.Errorf("expected S/MIME signing error to contain: %q, got: %s", expErr, err)
}
})
}
Expand Down

0 comments on commit ab6fc60

Please sign in to comment.