diff --git a/b64linebreaker_test.go b/b64linebreaker_test.go index 9340d8d..06599d2 100644 --- a/b64linebreaker_test.go +++ b/b64linebreaker_test.go @@ -5,487 +5,165 @@ package mail import ( - "bufio" "bytes" "encoding/base64" "errors" - "fmt" "io" "os" "testing" ) -const logoB64 = `PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PCFE -T0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53 -My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj48c3ZnIHdpZHRoPSIxMDAlIiBo -ZWlnaHQ9IjEwMCUiIHZpZXdCb3g9IjAgMCA2MDAgNjAwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJo -dHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3Jn -LzE5OTkveGxpbmsiIHhtbDpzcGFjZT0icHJlc2VydmUiIHhtbG5zOnNlcmlmPSJodHRwOi8vd3d3 -LnNlcmlmLmNvbS8iIHN0eWxlPSJmaWxsLXJ1bGU6ZXZlbm9kZDtjbGlwLXJ1bGU6ZXZlbm9kZDtz -dHJva2UtbGluZWNhcDpyb3VuZDtzdHJva2UtbGluZWpvaW46cm91bmQ7c3Ryb2tlLW1pdGVybGlt -aXQ6MS41OyI+PHJlY3QgaWQ9ItCc0L7QvdGC0LDQttC90LDRjy3QvtCx0LvQsNGB0YLRjDEiIHNl -cmlmOmlkPSLQnNC+0L3RgtCw0LbQvdCw0Y8g0L7QsdC70LDRgdGC0YwxIiB4PSIwIiB5PSIwIiB3 -aWR0aD0iNjAwIiBoZWlnaHQ9IjYwMCIgc3R5bGU9ImZpbGw6bm9uZTsiLz48Zz48cGF0aCBkPSJN -NTg0LjcyNiw5OC4zOTVjLTAsLTkuNzM4IC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N4PSIzNjEuNDEiIGN5PSIxMjcuNTgxIiByPSI0 -LjI4MiIgc3R5bGU9ImZpbGw6I2ZmYjI1YztzdHJva2U6IzAwMDtzdHJva2Utd2lkdGg6NC45NXB4 -OyIvPjwvZz48L3N2Zz4= -` - var ( - errMockDefault = errors.New("mock write error") - errMockNewline = errors.New("mock newline error") + errClosedWriter = errors.New("writer is already closed") + errMockDefault = errors.New("mock write error") + errMockNewline = errors.New("mock newline error") ) -// TestBase64LineBreaker tests the Write and Close methods of the Base64LineBreaker func TestBase64LineBreaker(t *testing.T) { - l, err := os.Open("assets/gopher2.svg") - if err != nil { - t.Errorf("failed to open gopher logo asset: %s", err) - return - } - defer func() { _ = l.Close() }() - - var wbuf bytes.Buffer - lb := Base64LineBreaker{out: &wbuf} - bw := base64.NewEncoder(base64.StdEncoding, &lb) - if _, err := io.Copy(bw, l); err != nil { - t.Errorf("failed to write logo asset to line breaker: %s", err) - return - } - if err := bw.Close(); err != nil { - t.Errorf("failed to close b64 encoder: %s", err) - } - if err := lb.Close(); err != nil { - t.Errorf("failed to close line breaker: %s", err) - } - ob := removeNewLines([]byte(logoB64)) - nb := removeNewLines(wbuf.Bytes()) - if string(ob) != string(nb) { - t.Errorf("generated line breaker output differs from original data") - } -} - -// TestBase64LineBreakerFailures tests the cases in which the Base64LineBreaker would fail -func TestBase64LineBreakerFailures(t *testing.T) { - stt := []byte("short") - ltt := []byte(logoB64) - - // No output writer defined - lb := Base64LineBreaker{} - if _, err := lb.Write(stt); err == nil { - t.Errorf("writing to Base64LineBreaker with no output io.Writer was supposed to failed, but didn't") - } - if err := lb.Close(); err != nil { - t.Errorf("failed to close Base64LineBreaker: %s", err) - } - - // Closed output writer - wbuf := errorWriter{} - fb := Base64LineBreaker{out: wbuf} - if _, err := fb.Write(ltt); err == nil { - t.Errorf("writing to Base64LineBreaker with errorWriter was supposed to failed, but didn't") - } - if err := fb.Close(); err != nil { - t.Errorf("failed to close Base64LineBreaker: %s", err) - } -} - -func TestBase64LineBreaker_WriteAndClose(t *testing.T) { - tests := []struct { - name string - data []byte - writer io.Writer - }{ - { - name: "Write data within MaxBodyLength", - data: []byte("testdata"), - writer: &mockWriterExcess{writeError: errMockDefault}, - }, - { - name: "Write data exceeds MaxBodyLength", - data: []byte("verylongtestdataverylongtestdataverylongtestdata" + - "verylongtestdataverylongtestdataverylongtestdata"), - writer: &mockWriterExcess{writeError: errMockDefault}, - }, - { - name: "Write data exceeds MaxBodyLength with newline", - data: []byte("verylongtestdataverylongtestdataverylongtestdata" + - "verylongtestdataverylongtestdataverylongtestdata"), - writer: &mockWriterNewline{writeError: errMockDefault}, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - blr := &Base64LineBreaker{out: tt.writer} - - _, err := blr.Write(tt.data) - 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, errMockDefault) && !errors.Is(err, errMockNewline) { - t.Errorf("Unexpected error while closing: %v", err) + t.Run("write, copy and close", func(t *testing.T) { + logoWriter := &bytes.Buffer{} + lineBreaker := &Base64LineBreaker{out: logoWriter} + t.Cleanup(func() { + if err := lineBreaker.Close(); err != nil { + t.Errorf("failed to close line breaker: %s", err) } }) - } + if _, err := lineBreaker.Write([]byte("testdata")); err != nil { + t.Errorf("failed to write to line breaker: %s", err) + } + }) + t.Run("write actual data and compare with expected results", func(t *testing.T) { + logo, err := os.Open("testdata/logo.svg") + if err != nil { + t.Fatalf("failed to open test data file: %s", err) + } + t.Cleanup(func() { + if err := logo.Close(); err != nil { + t.Errorf("failed to close test data file: %s", err) + } + }) + + logoWriter := &bytes.Buffer{} + lineBreaker := &Base64LineBreaker{out: logoWriter} + t.Cleanup(func() { + if err := lineBreaker.Close(); err != nil { + t.Errorf("failed to close line breaker: %s", err) + } + }) + base64Encoder := base64.NewEncoder(base64.StdEncoding, lineBreaker) + t.Cleanup(func() { + if err := base64Encoder.Close(); err != nil { + t.Errorf("failed to close base64 encoder: %s", err) + } + }) + copiedBytes, err := io.Copy(base64Encoder, logo) + if err != nil { + t.Errorf("failed to copy test data to line breaker: %s", err) + } + if err = base64Encoder.Close(); err != nil { + t.Errorf("failed to close base64 encoder: %s", err) + } + if err = lineBreaker.Close(); err != nil { + t.Errorf("failed to close line breaker: %s", err) + } + + logoStat, err := os.Stat("testdata/logo.svg") + if err != nil { + t.Fatalf("failed to stat test data file: %s", err) + } + if logoStat.Size() != copiedBytes { + t.Errorf("copied %d bytes, but expected %d bytes", copiedBytes, logoStat.Size()) + } + + expectedRaw, err := os.ReadFile("testdata/logo.svg.base64") + if err != nil { + t.Errorf("failed to read expected base64 data from file: %s", err) + } + expected := removeNewLines(t, expectedRaw) + got := removeNewLines(t, logoWriter.Bytes()) + if !bytes.EqualFold(expected, got) { + t.Errorf("generated line breaker output differs from expected data") + } + }) + t.Run("fail with no writer defined", func(t *testing.T) { + lineBreaker := &Base64LineBreaker{} + _, err := lineBreaker.Write([]byte("testdata")) + if err == nil { + t.Errorf("writing to Base64LineBreaker with no output io.Writer was supposed to failed, but didn't") + } + if !errors.Is(err, ErrNoOutWriter) { + t.Errorf("unexpected error while writing to empty Base64LineBreaker: %s", err) + } + if err := lineBreaker.Close(); err != nil { + t.Errorf("failed to close Base64LineBreaker: %s", err) + } + }) + t.Run("write on an already closed output writer", func(t *testing.T) { + logo, err := os.Open("testdata/logo.svg") + if err != nil { + t.Fatalf("failed to open test data file: %s", err) + } + t.Cleanup(func() { + if err := logo.Close(); err != nil { + t.Errorf("failed to close test data file: %s", err) + } + }) + + writeBuffer := &errorWriter{} + lineBreaker := &Base64LineBreaker{out: writeBuffer} + _, err = io.Copy(lineBreaker, logo) + if err == nil { + t.Errorf("writing to Base64LineBreaker with an already closed output io.Writer was " + + "supposed to failed, but didn't") + } + if !errors.Is(err, errClosedWriter) { + t.Errorf("unexpected error while writing to Base64LineBreaker: %s", err) + } + }) + t.Run("fail on different scenarios with mock writer", func(t *testing.T) { + tests := []struct { + name string + data []byte + writer io.Writer + }{ + { + name: "write data within MaxBodyLength", + data: []byte("testdata"), + writer: &mockWriterExcess{writeError: errMockDefault}, + }, + { + name: "write data exceeds MaxBodyLength", + data: []byte("verylongtestdataverylongtestdataverylongtestdata" + + "verylongtestdataverylongtestdataverylongtestdata"), + writer: &mockWriterExcess{writeError: errMockDefault}, + }, + { + name: "write data exceeds MaxBodyLength with newline", + data: []byte("verylongtestdataverylongtestdataverylongtestdata" + + "verylongtestdataverylongtestdataverylongtestdata"), + writer: &mockWriterNewline{writeError: errMockDefault}, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + lineBreaker := &Base64LineBreaker{out: tt.writer} + + _, err := lineBreaker.Write(tt.data) + if err != nil && !errors.Is(err, errMockDefault) && !errors.Is(err, errMockNewline) { + t.Errorf("unexpected error while writing to mock writer: %s", err) + } + err = lineBreaker.Close() + if err != nil && !errors.Is(err, errMockDefault) && !errors.Is(err, errMockNewline) { + t.Errorf("unexpected error while closing mock writer: %s", err) + } + }) + } + }) } -// removeNewLines removes any newline characters from the given data -func removeNewLines(data []byte) []byte { +// removeNewLines is a test helper thatremoves all newline characters ('\r' and '\n') from the given byte slice. +func removeNewLines(t *testing.T, data []byte) []byte { + t.Helper() result := make([]byte, len(data)) n := 0 @@ -503,11 +181,11 @@ func removeNewLines(data []byte) []byte { type errorWriter struct{} func (e errorWriter) Write([]byte) (int, error) { - return 0, fmt.Errorf("supposed to always fail") + return 0, errClosedWriter } func (e errorWriter) Close() error { - return fmt.Errorf("supposed to always fail") + return errClosedWriter } type mockWriterExcess struct { @@ -539,19 +217,46 @@ func (w *mockWriterNewline) Write(p []byte) (n int, err error) { } } -func FuzzBase64LineBreaker_Write(f *testing.F) { - f.Add([]byte("abc")) - f.Add([]byte("def")) - f.Add([]uint8{0o0, 0o1, 0o2, 30, 255}) - buf := bytes.Buffer{} - bw := bufio.NewWriter(&buf) +func FuzzBase64LineBreaker(f *testing.F) { + seedData := [][]byte{ + //[]byte(""), + []byte("abc"), + []byte("def"), + []byte("Hello, World!"), + []byte("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!ยง$%&/()=?`{[]}\\|^~*+#-._'"), + []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), + bytes.Repeat([]byte("A"), MaxBodyLength-1), // Near the line length limit + bytes.Repeat([]byte("A"), MaxBodyLength), // Exactly the line length limit + bytes.Repeat([]byte("A"), MaxBodyLength+1), // Slightly above the line length limit + bytes.Repeat([]byte("A"), MaxBodyLength*3), // Tripple exceed the line length limit + bytes.Repeat([]byte("A"), MaxBodyLength*10), // Tenfold exceed the line length limit + {0o0, 0o1, 0o2, 30, 255}, + } + for _, data := range seedData { + f.Add(data) + } + f.Fuzz(func(t *testing.T, data []byte) { - b := &Base64LineBreaker{out: bw} - if _, err := b.Write(data); err != nil { - t.Errorf("failed to write to B64LineBreaker: %s", err) + var buffer bytes.Buffer + lineBreaker := &Base64LineBreaker{ + out: &buffer, } - if err := b.Close(); err != nil { - t.Errorf("failed to close B64LineBreaker: %s", err) + base64Encoder := base64.NewEncoder(base64.StdEncoding, lineBreaker) + + _, err := base64Encoder.Write(data) + if err != nil { + t.Errorf("failed to write test data to base64 encoder: %s", err) + } + if err = base64Encoder.Close(); err != nil { + t.Errorf("failed to close base64 encoder: %s", err) + } + if err = lineBreaker.Close(); err != nil { + t.Errorf("failed to close base64 line breaker: %s", err) + } + + decode, err := base64.StdEncoding.DecodeString(buffer.String()) + if !bytes.Equal(data, decode) { + t.Error("generated line breaker output differs from original data") } }) }