aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/ast/parser_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/ast/parser_test.go')
-rw-r--r--pkg/ast/parser_test.go15
1 files changed, 5 insertions, 10 deletions
diff --git a/pkg/ast/parser_test.go b/pkg/ast/parser_test.go
index cecdcc9b2..5e25157f5 100644
--- a/pkg/ast/parser_test.go
+++ b/pkg/ast/parser_test.go
@@ -4,14 +4,13 @@
package ast
import (
- "bytes"
"os"
"path/filepath"
- "reflect"
"strings"
"testing"
"github.com/google/syzkaller/sys/targets"
+ "github.com/stretchr/testify/assert"
)
func TestParseAll(t *testing.T) {
@@ -47,14 +46,9 @@ func TestParseAll(t *testing.T) {
if n1 == nil {
t.Fatalf("got nil node")
}
- if !reflect.DeepEqual(n1, n2) {
- t.Fatalf("formatting changed code:\n%#v\nvs:\n%#v", n1, n2)
- }
- }
- data3 := Format(desc.Clone())
- if !bytes.Equal(data, data3) {
- t.Fatalf("Clone lost data")
+ assert.Equal(t, n1, n2, "formating changed code")
}
+ assert.Equal(t, string(data), string(Format(desc.Clone())))
nodes0 := 0
desc.Walk(func(n Node) {
nodes0++
@@ -63,12 +57,13 @@ func TestParseAll(t *testing.T) {
}
})
nodes1 := 0
- desc.Walk(Recursive(func(n Node) {
+ desc.Walk(Recursive(func(n Node) bool {
nodes1++
pos, typ, _ := n.Info()
if typ == "" {
t.Fatalf("%v: node has empty typ=%q: %#v", pos, typ, n)
}
+ return true
}))
nodes2 := 0
desc.Walk(PostRecursive(func(n Node) {