Skip to content

Commit

Permalink
add some experimental fuzzing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zekroTJA committed Jun 13, 2024
1 parent 129b820 commit ad507e9
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions pkg/goatfile/parser_fuzz_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package goatfile

import (
"testing"
)

func FuzzParseUse(f *testing.F) {
f.Add(" foo.goat")
f.Add(" foo")
f.Add(" foo/bar/baz.goat")
f.Add(" foo/bar/baz")
f.Fuzz(func(t *testing.T, s string) {
p := stringParser(s)
_, _ = p.parseUse()
})
}

func FuzzParseExecute(f *testing.F) {
f.Add(` foo.goat (hello="foo") return (foo as bar)`)
f.Add(` foo.goat (foo="foo" bar="bar") return (foo as bar)`)
f.Add(` foo.goat (
foo="foo"
bar="bar"
) return (
foo as bar
baz as fuz
)`)
f.Fuzz(func(t *testing.T, s string) {
p := stringParser(s)
_, _, _ = p.parseExecute()
})
}

0 comments on commit ad507e9

Please sign in to comment.