mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-21 21:30:50 +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 (
|
var (
|
||||||
mockErr = errors.New("mock write error")
|
errMockDefault = errors.New("mock write error")
|
||||||
mockNewlineErr = errors.New("mock newline error")
|
errMockNewline = errors.New("mock newline error")
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestBase64LineBreaker tests the Write and Close methods of the Base64LineBreaker
|
// 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",
|
name: "Write data within MaxBodyLength",
|
||||||
data: []byte("testdata"),
|
data: []byte("testdata"),
|
||||||
writer: &mockWriterExcess{writeError: mockErr},
|
writer: &mockWriterExcess{writeError: errMockDefault},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Write data exceeds MaxBodyLength",
|
name: "Write data exceeds MaxBodyLength",
|
||||||
data: []byte("verylongtestdataverylongtestdataverylongtestdata" +
|
data: []byte("verylongtestdataverylongtestdataverylongtestdata" +
|
||||||
"verylongtestdataverylongtestdataverylongtestdata"),
|
"verylongtestdataverylongtestdataverylongtestdata"),
|
||||||
writer: &mockWriterExcess{writeError: mockErr},
|
writer: &mockWriterExcess{writeError: errMockDefault},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Write data exceeds MaxBodyLength with newline",
|
name: "Write data exceeds MaxBodyLength with newline",
|
||||||
data: []byte("verylongtestdataverylongtestdataverylongtestdata" +
|
data: []byte("verylongtestdataverylongtestdataverylongtestdata" +
|
||||||
"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}
|
blr := &Base64LineBreaker{out: tt.writer}
|
||||||
|
|
||||||
_, err := blr.Write(tt.data)
|
_, 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)
|
t.Errorf("Unexpected error while writing: %v", err)
|
||||||
}
|
}
|
||||||
err = blr.Close()
|
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)
|
t.Errorf("Unexpected error while closing: %v", err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -524,7 +524,7 @@ func (w *mockWriterExcess) Write(p []byte) (n int, err error) {
|
||||||
case 2:
|
case 2:
|
||||||
return 2, nil
|
return 2, nil
|
||||||
default:
|
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:
|
case 0:
|
||||||
return 0, nil
|
return 0, nil
|
||||||
case 2:
|
case 2:
|
||||||
return 2, mockNewlineErr
|
return 2, errMockNewline
|
||||||
default:
|
default:
|
||||||
return len(p), nil
|
return len(p), nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue