...
1
2
3 package toml
4
5 func Fuzz(data []byte) int {
6 tree, err := LoadBytes(data)
7 if err != nil {
8 if tree != nil {
9 panic("tree must be nil if there is an error")
10 }
11 return 0
12 }
13
14 str, err := tree.ToTomlString()
15 if err != nil {
16 if str != "" {
17 panic(`str must be "" if there is an error`)
18 }
19 panic(err)
20 }
21
22 tree, err = Load(str)
23 if err != nil {
24 if tree != nil {
25 panic("tree must be nil if there is an error")
26 }
27 return 0
28 }
29
30 return 1
31 }
32
View as plain text