mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-23 14:10:50 +01:00
Switch to using bytes.NewBuffer(nil) in tests
Refactored the test code to initialize buffers using bytes.NewBuffer(nil) instead of &bytes.Buffer{}. This change ensures a consistent and idiomatic initialization of byte buffers throughout the test cases.
This commit is contained in:
parent
12695385e8
commit
21184e60b9
1 changed files with 4 additions and 4 deletions
|
@ -21,7 +21,7 @@ var (
|
||||||
|
|
||||||
func TestBase64LineBreaker(t *testing.T) {
|
func TestBase64LineBreaker(t *testing.T) {
|
||||||
t.Run("write, copy and close", func(t *testing.T) {
|
t.Run("write, copy and close", func(t *testing.T) {
|
||||||
logoWriter := &bytes.Buffer{}
|
logoWriter := bytes.NewBuffer(nil)
|
||||||
lineBreaker := &Base64LineBreaker{out: logoWriter}
|
lineBreaker := &Base64LineBreaker{out: logoWriter}
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
if err := lineBreaker.Close(); err != nil {
|
if err := lineBreaker.Close(); err != nil {
|
||||||
|
@ -43,7 +43,7 @@ func TestBase64LineBreaker(t *testing.T) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
logoWriter := &bytes.Buffer{}
|
logoWriter := bytes.NewBuffer(nil)
|
||||||
lineBreaker := &Base64LineBreaker{out: logoWriter}
|
lineBreaker := &Base64LineBreaker{out: logoWriter}
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
if err := lineBreaker.Close(); err != nil {
|
if err := lineBreaker.Close(); err != nil {
|
||||||
|
@ -237,9 +237,9 @@ func FuzzBase64LineBreaker(f *testing.F) {
|
||||||
}
|
}
|
||||||
|
|
||||||
f.Fuzz(func(t *testing.T, data []byte) {
|
f.Fuzz(func(t *testing.T, data []byte) {
|
||||||
var buffer bytes.Buffer
|
buffer := bytes.NewBuffer(nil)
|
||||||
lineBreaker := &Base64LineBreaker{
|
lineBreaker := &Base64LineBreaker{
|
||||||
out: &buffer,
|
out: buffer,
|
||||||
}
|
}
|
||||||
base64Encoder := base64.NewEncoder(base64.StdEncoding, lineBreaker)
|
base64Encoder := base64.NewEncoder(base64.StdEncoding, lineBreaker)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue