mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-09 15:32:54 +01:00
Add fuzz testing to Base64LineBreaker_Write function
The update enhances testing for the Base64LineBreaker_Write function by creating a fuzz test. This new fuzz test feeds the function with a wide range of random byte inputs to improve the detection of hidden anomalies and help ensure more robust code.
This commit is contained in:
parent
932ac2be48
commit
280f85abd1
1 changed files with 11 additions and 0 deletions
|
@ -461,3 +461,14 @@ func (e errorWriter) Write([]byte) (int, error) {
|
|||
func (e errorWriter) Close() error {
|
||||
return fmt.Errorf("supposed to always fail")
|
||||
}
|
||||
|
||||
func FuzzBase64LineBreaker_Write(f *testing.F) {
|
||||
f.Add([]byte(logoB64))
|
||||
buf := bytes.Buffer{}
|
||||
f.Fuzz(func(t *testing.T, data []byte) {
|
||||
b := &Base64LineBreaker{out: &buf}
|
||||
if _, err := b.Write(data); err != nil {
|
||||
t.Errorf("failed to write to B64LineBreaker: %s", err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue