Skip to content

Commit a97733c

Browse files
committed
x/exp/ast: clean up tests
Addresses #37 Signed-off-by: philhassey <phil@strongdm.com>
1 parent 368d948 commit a97733c

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

x/exp/ast/inspect_test.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ import (
77
"github.com/cedar-policy/cedar-go/types"
88
)
99

10-
func countNodes(n Node) int {
11-
c := 0
12-
Inspect(n, func(IsNode) bool { c++; return true })
13-
return c
14-
}
15-
1610
func TestInspectCounts(t *testing.T) {
1711
t.Parallel()
1812
leaf1 := NodeValue{Value: types.Long(1)}
@@ -62,7 +56,9 @@ func TestInspectCounts(t *testing.T) {
6256
tt := tt
6357
t.Run(tt.name, func(t *testing.T) {
6458
t.Parallel()
65-
testutil.Equals(t, countNodes(tt.node), tt.want)
59+
c := 0
60+
Inspect(tt.node, func(IsNode) bool { c++; return true })
61+
testutil.Equals(t, c, tt.want)
6662
})
6763
}
6864
}
@@ -85,7 +81,6 @@ func TestInspectSkipChildren(t *testing.T) {
8581
func TestInspectNil(t *testing.T) {
8682
t.Parallel()
8783
var count int
88-
// Test that Inspect handles nil Node gracefully without panicking
8984
Inspect(Node{}, func(n IsNode) bool {
9085
count++
9186
return true

0 commit comments

Comments
 (0)