github.com/rajeev159/opa@v0.45.0/ast/fuzz_test.go (about) 1 // Copyright 2021 The OPA Authors. All rights reserved. 2 // Use of this source code is governed by an Apache2 3 // license that can be found in the LICENSE file. 4 5 //go:build go1.18 6 // +build go1.18 7 8 package ast 9 10 import "testing" 11 12 func FuzzParseStatementsAndCompileModules(f *testing.F) { 13 f.Fuzz(func(t *testing.T, input string) { 14 t.Parallel() // seed corpus tests can run in parallel 15 _, _, err := ParseStatements("", input) 16 if err == nil { 17 // CompileModules is expected to error, but it shouldn't panic 18 CompileModules(map[string]string{"": input}) //nolint 19 } 20 }) 21 }