github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/utils/ansititle/ansititle_fuzz_test.go (about)

     1  //go:build go1.18
     2  // +build go1.18
     3  
     4  package ansititle
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/lmorg/murex/test/count"
    10  )
    11  
    12  var fuzzTests = []string{"", ".", `!"£$%^&*()`, "12345!", "foobar", "世", "世界"}
    13  
    14  func FuzzFormatTitle(f *testing.F) {
    15  	for _, tc := range fuzzTests {
    16  		f.Add(tc)
    17  	}
    18  
    19  	f.Fuzz(func(t *testing.T, title string) {
    20  		count.Tests(t, 1)
    21  		formatTitle([]byte(title))
    22  		// we are just testing we can't cause an unhandled panic
    23  	})
    24  }
    25  
    26  func FuzzFormatTmux(f *testing.F) {
    27  	for _, tc := range fuzzTests {
    28  		f.Add(tc)
    29  	}
    30  
    31  	f.Fuzz(func(t *testing.T, title string) {
    32  		count.Tests(t, 1)
    33  		formatTmux([]byte(title))
    34  		// we are just testing we can't cause an unhandled panic
    35  	})
    36  }
    37  
    38  func FuzzSanatise(f *testing.F) {
    39  	for _, tc := range fuzzTests {
    40  		f.Add(tc)
    41  	}
    42  
    43  	f.Fuzz(func(t *testing.T, title string) {
    44  		count.Tests(t, 1)
    45  		sanatise([]byte(title))
    46  		// we are just testing we can't cause an unhandled panic
    47  	})
    48  }