Skip to content

Commit 971b654

Browse files
committed
pattern: migrate to native fuzz tests
Closes gh-1259
1 parent 60e104c commit 971b654

File tree

88 files changed

+266
-51
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+266
-51
lines changed

pattern/fuzz.go

-51
This file was deleted.

pattern/parser_test.go

+94
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
package pattern
22

33
import (
4+
"fmt"
5+
"go/ast"
6+
goparser "go/parser"
7+
"go/token"
8+
"os"
9+
"path/filepath"
10+
"reflect"
11+
"runtime"
12+
"strings"
413
"testing"
514
)
615

@@ -18,3 +27,88 @@ func TestParse(t *testing.T) {
1827
}
1928
}
2029
}
30+
31+
func FuzzParse(f *testing.F) {
32+
var files []*ast.File
33+
fset := token.NewFileSet()
34+
35+
// Ideally we'd check against as much source code as possible, but that's fairly slow, on the order of 500ms per
36+
// pattern when checking against the whole standard library.
37+
//
38+
// We pick the runtime package in the hopes that it contains the most diverse, and weird, code.
39+
filepath.Walk(runtime.GOROOT()+"/src/runtime", func(path string, info os.FileInfo, err error) error {
40+
if err != nil {
41+
// XXX error handling
42+
panic(err)
43+
}
44+
if !strings.HasSuffix(path, ".go") {
45+
return nil
46+
}
47+
f, err := goparser.ParseFile(fset, path, nil, goparser.SkipObjectResolution)
48+
if err != nil {
49+
return nil
50+
}
51+
files = append(files, f)
52+
return nil
53+
})
54+
55+
parse := func(in string, allowTypeInfo bool) (Pattern, bool) {
56+
p := Parser{
57+
AllowTypeInfo: allowTypeInfo,
58+
}
59+
pat, err := p.Parse(string(in))
60+
if err != nil {
61+
if strings.Contains(err.Error(), "internal error") {
62+
panic(err)
63+
}
64+
return Pattern{}, false
65+
}
66+
return pat, true
67+
}
68+
69+
f.Fuzz(func(t *testing.T, in []byte) {
70+
defer func() {
71+
if err := recover(); err != nil {
72+
str := fmt.Sprint(err)
73+
if strings.Contains(str, "binding already created:") {
74+
// This is an invalid pattern, not a real failure
75+
} else {
76+
// Re-panic the original panic
77+
panic(err)
78+
}
79+
}
80+
}()
81+
// Parse twice, once with AllowTypeInfo set to true to exercise the parser, and once with it set to false so we
82+
// can actually use it in Match, as we don't have type information available.
83+
84+
pat, ok := parse(string(in), true)
85+
if !ok {
86+
return
87+
}
88+
// Make sure we can turn it back into a string
89+
_ = pat.Root.String()
90+
91+
pat, ok = parse(string(in), false)
92+
if !ok {
93+
return
94+
}
95+
// Make sure we can turn it back into a string
96+
_ = pat.Root.String()
97+
98+
// Don't check patterns with too many relevant nodes; it's too expensive
99+
if len(pat.Relevant) < 20 {
100+
// Make sure trying to match nodes doesn't panic
101+
for _, f := range files {
102+
ast.Inspect(f, func(node ast.Node) bool {
103+
rt := reflect.TypeOf(node)
104+
// We'd prefer calling Match on all nodes, not just those the pattern deems relevant, to find more bugs.
105+
// However, doing so has a 10x cost in execution time.
106+
if _, ok := pat.Relevant[rt]; ok {
107+
Match(pat, node)
108+
}
109+
return true
110+
})
111+
}
112+
}
113+
})
114+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(AssignStmt ident \":=\" expr)")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(CallExpr (SelectorExpr recv (Ident \"String\")) [])")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(Or________________________________________________________________________________________________________________________________)")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(CallExpr (SelectorExpr lhs (Ident \"Equal\")) rhs)")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(AssignStmt x tok@(Or \"+=\" \"-=\") (BasicLit \"INT\" \"1\"))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("\n\t\t(ForStmt\n\t\t\tnil nil nil\n\t\t\tselect@(SelectStmt\n\t\t\t\t(CommClause\n\t\t\t\t\t(Or\n\t\t\t\t\t\t(UnaryExpr \"<-\" _)\n\t\t\t\t\t\t(AssignStmt _ _ (UnaryExpr \"<-\" _)))\n\t\t\t\t\t_)))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(CallExpr fun@(SelectorExpr _ (Ident \"Seek\")) [arg1@(SelectorExpr (Ident \"io\") (Ident (Or \"SeekStart\" \"SeekCurrent\" \"SeekEnd\"))) arg2])")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(BinaryExpr left@(TrulyConstantExpression _) tok@(Or \"==\" \"!=\") right@(Not (TrulyConstantExpression _)))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(CallExpr (SelectorExpr (CallExpr (Function \"time.Now\") []) (Function \"(time.Time).Sub\")) [arg])")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("\n\t(IfStmt\n\t\tnil\n\t\t(BinaryExpr x@(Object _) \"!=\" (Builtin \"nil\"))\n\t\t[(RangeStmt _ _ _ x _)]\n\t\tnil)")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(IfStmt nil cond [(ReturnStmt [ret@(Builtin (Or \"true\" \"false\"))])] nil)")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(CallExpr(Ident(SelectorExpr(Ident\"\")(Ident\"\")))[])")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("\n\t(GoStmt\n\t\t(CallExpr\n\t\t\t(FuncLit\n\t\t\t\t_\n\t\t\t\tcall@(CallExpr (Function \"(*sync.WaitGroup).Add\") _):_) _))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("\n\t\t(IfStmt\n\t\t\tnil\n\t\t\t(BinaryExpr lhs@(Object _) \"!=\" (Builtin \"nil\"))\n\t\t\t[\n\t\t\t\tifstmt@(IfStmt\n\t\t\t\t\t(AssignStmt [(Ident \"_\") ok@(Object _)] _ [(TypeAssertExpr lhs _)])\n\t\t\t\t\tok\n\t\t\t\t\t_\n\t\t\t\t\tnil)\n\t\t\t]\n\t\t\tnil)")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(CallExpr (Ident \"string\") [arg])")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(AssignStmt x@(Object _) \":=\" assign@(Builtin b@(Or \"true\" \"false\")))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(ForStmt nil nil nil if@(IfStmt nil cond (BranchStmt \"BREAK\" nil) nil):_)")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(CallExpr (Builtin \"make\") [typ size size])")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(CallExpr (SelectorExpr (CallExpr (SelectorExpr recv (Ident \"Query\")) []) (Ident meth)) _)")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(UnaryExpr \"!\" expr@(BinaryExpr _ _ _))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("\n\t(IfStmt\n\t\t(AssignStmt\n\t\t\t[(Ident \"_\") ok@(Ident _)]\n\t\t\t\":=\"\n\t\t\t(IndexExpr m key))\n\t\tok\n\t\t[call@(CallExpr (Builtin \"delete\") [m key])]\n\t\tnil)")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(CallExpr fun@(Function _) (Builtin \"nil\"):_)")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("\n\t\t(AssignStmt\n\t\t\t(Ident \"_\") _ recv@(UnaryExpr \"<-\" _))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(BinaryExpr duration \"*\" (SelectorExpr (Ident \"time\") (Ident \"Second\")))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("\n\t\t(Or\n\t\t\t(CallExpr\n\t\t\t\tfn@(Or\n\t\t\t\t\t(Function \"fmt.Print\")\n\t\t\t\t\t(Function \"fmt.Sprint\")\n\t\t\t\t\t(Function \"fmt.Println\")\n\t\t\t\t\t(Function \"fmt.Sprintln\"))\n\t\t\t\t[(CallExpr (Function \"fmt.Sprintf\") f:_)])\n\t\t\t(CallExpr\n\t\t\t\tfn@(Or\n\t\t\t\t\t(Function \"fmt.Fprint\")\n\t\t\t\t\t(Function \"fmt.Fprintln\"))\n\t\t\t\t[_ (CallExpr (Function \"fmt.Sprintf\") f:_)]))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(CallExpr (SelectorExpr (Ident \"bytes\") (Ident \"Equal\")) args)")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("\n\t(CallExpr\n\t\tfn@(Or\n\t\t\t(Function \"fmt.Sprint\")\n\t\t\t(Function \"fmt.Sprintf\"))\n\t\t[lit@(BasicLit \"STRING\" _)])")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("\n\t\t(ForStmt\n\t\t\t(AssignStmt initvar@(Ident _) _ (IntegerLiteral \"0\"))\n\t\t\t(BinaryExpr initvar \"<\" limit@(Ident _))\n\t\t\t(IncDecStmt initvar \"++\")\n\t\t\t[(AssignStmt\n\t\t\t\t(IndexExpr slice@(Ident _) initvar)\n\t\t\t\t\"=\"\n\t\t\t\t(IndexExpr slice (BinaryExpr offset@(Ident _) \"+\" initvar)))])")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(CallExpr (Function \"time.Sleep\") lit@(IntegerLiteral value))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(ForStmt a a a(IfStmt a b(BranchStmt nil a)a):a)")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(CallExpr (Function \"errors.New\") [(CallExpr (Function \"fmt.Sprintf\") args)])")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("\n\t(Or\n\t\t(IfStmt\n\t\t\t(AssignStmt [(Ident \"_\") ok@(Ident _)] \":=\" indexexpr@(IndexExpr _ _))\n\t\t\tok\n\t\t\tset@(AssignStmt indexexpr \"=\" (CallExpr (Builtin \"append\") indexexpr:values))\n\t\t\t(AssignStmt indexexpr \"=\" (CompositeLit _ values)))\n\t\t(IfStmt\n\t\t\t(AssignStmt [(Ident \"_\") ok] \":=\" indexexpr@(IndexExpr _ _))\n\t\t\tok\n\t\t\tset@(AssignStmt indexexpr \"+=\" value)\n\t\t\t(AssignStmt indexexpr \"=\" value))\n\t\t(IfStmt\n\t\t\t(AssignStmt [(Ident \"_\") ok] \":=\" indexexpr@(IndexExpr _ _))\n\t\t\tok\n\t\t\tset@(IncDecStmt indexexpr \"++\")\n\t\t\t(AssignStmt indexexpr \"=\" (IntegerLiteral \"1\"))))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(CallExpr (SelectorExpr (Ident \"time\") (Ident \"Since\")) [arg])")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(BinaryExpr\n\t\t(UnaryExpr \"&\" _)\n\t\t(Or \"==\" \"!=\")\n\t\t(Builtin \"nil\"))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("\n\t(CallExpr\n\t\t(SelectorExpr recv (Ident \"WriteString\"))\n\t\t(CallExpr\n\t\t\tfn@(Or\n\t\t\t\t(Function \"fmt.Sprint\")\n\t\t\t\t(Function \"fmt.Sprintf\")\n\t\t\t\t(Function \"fmt.Sprintln\"))\n\t\t\targs))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(Or[a a])")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(Or\n\t(CallExpr fn@(Function \"strings.Replace\") [_ _ _ lit@(IntegerLiteral \"-1\")])\n\t(CallExpr fn@(Function \"strings.SplitN\") [_ _ lit@(IntegerLiteral \"-1\")])\n\t(CallExpr fn@(Function \"strings.SplitAfterN\") [_ _ lit@(IntegerLiteral \"-1\")])\n\t(CallExpr fn@(Function \"bytes.Replace\") [_ _ _ lit@(IntegerLiteral \"-1\")])\n\t(CallExpr fn@(Function \"bytes.SplitN\") [_ _ lit@(IntegerLiteral \"-1\")])\n\t(CallExpr fn@(Function \"bytes.SplitAfterN\") [_ _ lit@(IntegerLiteral \"-1\")]))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("\n\t\t(AssignStmt\n\t\t\t[_ (Ident \"_\")]\n\t\t\t_\n\t\t\t(Or\n\t\t\t\t(IndexExpr _ _)\n\t\t\t\t(UnaryExpr \"<-\" _))) ")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(CallExpr (SelectorExpr recv (Ident \"Bytes\")) [])")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("\n\t\t(CallExpr\n\t\t\tsel@(SelectorExpr\n\t\t\t\trecv\n\t\t\t\t(Ident\n\t\t\t\t\tname@(Or\n\t\t\t\t\t\t\"Error\"\n\t\t\t\t\t\t\"Fatal\"\n\t\t\t\t\t\t\"Fatalln\"\n\t\t\t\t\t\t\"Log\"\n\t\t\t\t\t\t\"Panic\"\n\t\t\t\t\t\t\"Panicln\"\n\t\t\t\t\t\t\"Print\"\n\t\t\t\t\t\t\"Println\"\n\t\t\t\t\t\t\"Skip\")))\n\t\t\t[(CallExpr (Function \"fmt.Sprintf\") args)])")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("\n\t\t(CallExpr\n\t\t\t(Function\n\t\t\t\t(Or\n\t\t\t\t\t\"log.Fatal\"\n\t\t\t\t\t\"log.Fatalln\"\n\t\t\t\t\t\"log.Panic\"\n\t\t\t\t\t\"log.Panicln\"\n\t\t\t\t\t\"log.Print\"\n\t\t\t\t\t\"log.Println\"))\n\t\t\t[(CallExpr (Function \"fmt.Sprintf\") args)])")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("\n\t\t(Or\n\t\t\t(RangeStmt\n\t\t\t\tkey@(Ident _) value@(Ident _) \":=\" src\n\t\t\t\t[(AssignStmt (IndexExpr dst key) \"=\" value)])\n\t\t\t(RangeStmt\n\t\t\t\tkey@(Ident _) nil \":=\" src\n\t\t\t\t[(AssignStmt (IndexExpr dst key) \"=\" (IndexExpr src key))])\n\t\t\t(ForStmt\n\t\t\t\t(AssignStmt key@(Ident _) \":=\" (IntegerLiteral \"0\"))\n\t\t\t\t(BinaryExpr key \"<\" (CallExpr (Function \"len\") [src]))\n\t\t\t\t(IncDecStmt key \"++\")\n\t\t\t\t[(AssignStmt (IndexExpr dst key) \"=\" (IndexExpr src key))]))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("\n\t(Or\n\t\t(UnaryExpr\n\t\t\t\"-\"\n\t\t\t(BasicLit \"FLOAT\" \"0.0\"))\n\n\t\t(UnaryExpr\n\t\t\t\"-\"\n\t\t\t(CallExpr conv@(Object (Or \"float32\" \"float64\")) lit@(Or (BasicLit \"INT\" \"0\") (BasicLit \"FLOAT\" \"0.0\"))))\n\n\t\t(CallExpr\n\t\t\tconv@(Object (Or \"float32\" \"float64\"))\n\t\t\t(UnaryExpr \"-\" lit@(BasicLit \"INT\" \"0\"))))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(UnaryExpr \"&\" (StarExpr obj))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(BinaryExpr _ \"%\" (IntegerLiteral \"1\"))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("\n\t\t(IfStmt\n\t\t\t(AssignStmt [(Ident \"_\") ok@(Object _)] _ [(TypeAssertExpr assert@(Object _) _)])\n\t\t\t(Or\n\t\t\t\t(BinaryExpr ok \"&&\" (BinaryExpr assert \"!=\" (Builtin \"nil\")))\n\t\t\t\t(BinaryExpr (BinaryExpr assert \"!=\" (Builtin \"nil\")) \"&&\" ok))\n\t\t\t_\n\t\t\t_)")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(ReturnStmt [ret@(Builtin (Or \"true\" \"false\"))])")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(CallExpr (Function \"(time.Time).Sub\") [(CallExpr (Function \"time.Now\") [])])")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(CallExpr (Builtin \"make\") [typ size@(IntegerLiteral \"0\")])")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(AssignStmt[a(Ident\"_\")]a(Or(IndexExpr_a)(UnaryExpr\"\"a)))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(BinaryExpr (CallExpr (Function \"bytes.Compare\") args) op@(Or \"==\" \"!=\") (IntegerLiteral \"0\"))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(SliceExpr x@(Object _) low (CallExpr (Builtin \"len\") [x]) nil)")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(CallExpr _ [(CallExpr sel@(SelectorExpr recv _) [])])")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("\n\t(BinaryExpr\n\t\t(CallExpr fun@(Function (Or \"strings.ToLower\" \"strings.ToUpper\")) [a])\n \t\ttok@(Or \"==\" \"!=\")\n \t\t(CallExpr fun [b]))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(CallExpr (SelectorExpr (Ident \"time\") (Ident \"Until\")) [arg])")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(IfStmt (AssignStmt [obj@(Ident _) ok@(Ident _)] \":=\" assert@(TypeAssertExpr obj _)) ok _ elseBranch)")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(IntegerLiteral tv)")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(AssignStmt a a@(Or\"0\"\"0\")(BasicLit\"000\"\"\"))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("\n\t(Or\n\t\t(BinaryExpr\n\t\t\t(IntegerLiteral \"0\")\n\t\t\t\">\"\n\t\t\t(CallExpr builtin@(Builtin (Or \"len\" \"cap\")) _))\n\t\t(BinaryExpr\n\t\t\t(CallExpr builtin@(Builtin (Or \"len\" \"cap\")) _)\n\t\t\t\"<\"\n\t\t\t(IntegerLiteral \"0\")))\n")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(UnaryExpr \"!\" (CallExpr (SelectorExpr (Ident \"bytes\") (Ident \"Equal\")) args))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("\n(Or\n\t(RangeStmt\n\t\t(Ident \"_\")\n\t\tval@(Object _)\n\t\t_\n\t\tx\n\t\t[(AssignStmt [lhs] \"=\" [(CallExpr (Builtin \"append\") [lhs val])])])\n\t(RangeStmt\n\t\tidx@(Ident _)\n\t\tnil\n\t\t_\n\t\tx\n\t\t[(AssignStmt [lhs] \"=\" [(CallExpr (Builtin \"append\") [lhs (IndexExpr x idx)])])])\n\t(RangeStmt\n\t\tidx@(Ident _)\n\t\tnil\n\t\t_\n\t\tx\n\t\t[(AssignStmt val@(Object _) \":=\" (IndexExpr x idx))\n\t\t(AssignStmt [lhs] \"=\" [(CallExpr (Builtin \"append\") [lhs val])])]))")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
go test fuzz v1
2+
[]byte("(BinaryExpr duration \"*\" (SelectorExpr (Ident \"time\") (Ident \"Nanosecond\")))")

0 commit comments

Comments
 (0)