mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-24 22:50:49 +01:00
Rename error variables in b64linebreaker_test.go
In b64linebreaker_test.go, the names of error variables "mockErr" and "mockNewlineErr" have been changed to "errMockDefault" and "errMockNewline" to better clarify their roles. All instances in test cases where these error variables were used have been updated correspondingly.
This commit is contained in:
parent
4d6bca0f65
commit
86e648a695
1 changed files with 9 additions and 9 deletions
|
@ -385,8 +385,8 @@ OyIvPjwvZz48L3N2Zz4=
|
|||
`
|
||||
|
||||
var (
|
||||
mockErr = errors.New("mock write error")
|
||||
mockNewlineErr = errors.New("mock newline error")
|
||||
errMockDefault = errors.New("mock write error")
|
||||
errMockNewline = errors.New("mock newline error")
|
||||
)
|
||||
|
||||
// TestBase64LineBreaker tests the Write and Close methods of the Base64LineBreaker
|
||||
|
@ -452,19 +452,19 @@ func TestBase64LineBreaker_WriteAndClose(t *testing.T) {
|
|||
{
|
||||
name: "Write data within MaxBodyLength",
|
||||
data: []byte("testdata"),
|
||||
writer: &mockWriterExcess{writeError: mockErr},
|
||||
writer: &mockWriterExcess{writeError: errMockDefault},
|
||||
},
|
||||
{
|
||||
name: "Write data exceeds MaxBodyLength",
|
||||
data: []byte("verylongtestdataverylongtestdataverylongtestdata" +
|
||||
"verylongtestdataverylongtestdataverylongtestdata"),
|
||||
writer: &mockWriterExcess{writeError: mockErr},
|
||||
writer: &mockWriterExcess{writeError: errMockDefault},
|
||||
},
|
||||
{
|
||||
name: "Write data exceeds MaxBodyLength with newline",
|
||||
data: []byte("verylongtestdataverylongtestdataverylongtestdata" +
|
||||
"verylongtestdataverylongtestdataverylongtestdata"),
|
||||
writer: &mockWriterNewline{writeError: mockErr},
|
||||
writer: &mockWriterNewline{writeError: errMockDefault},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -473,11 +473,11 @@ func TestBase64LineBreaker_WriteAndClose(t *testing.T) {
|
|||
blr := &Base64LineBreaker{out: tt.writer}
|
||||
|
||||
_, err := blr.Write(tt.data)
|
||||
if err != nil && !errors.Is(err, mockErr) && !errors.Is(err, mockNewlineErr) {
|
||||
if err != nil && !errors.Is(err, errMockDefault) && !errors.Is(err, errMockNewline) {
|
||||
t.Errorf("Unexpected error while writing: %v", err)
|
||||
}
|
||||
err = blr.Close()
|
||||
if err != nil && !errors.Is(err, mockErr) && !errors.Is(err, mockNewlineErr) {
|
||||
if err != nil && !errors.Is(err, errMockDefault) && !errors.Is(err, errMockNewline) {
|
||||
t.Errorf("Unexpected error while closing: %v", err)
|
||||
}
|
||||
})
|
||||
|
@ -524,7 +524,7 @@ func (w *mockWriterExcess) Write(p []byte) (n int, err error) {
|
|||
case 2:
|
||||
return 2, nil
|
||||
default:
|
||||
return len(p), mockErr
|
||||
return len(p), errMockDefault
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -533,7 +533,7 @@ func (w *mockWriterNewline) Write(p []byte) (n int, err error) {
|
|||
case 0:
|
||||
return 0, nil
|
||||
case 2:
|
||||
return 2, mockNewlineErr
|
||||
return 2, errMockNewline
|
||||
default:
|
||||
return len(p), nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue