Skip to content

Commit

Permalink
test: fix test expectations now that we use LeafSlice
Browse files Browse the repository at this point in the history
Signed-off-by: Manan Gupta <manan@planetscale.com>
  • Loading branch information
GuptaManan100 committed Feb 11, 2025
1 parent 061e8ed commit 59c422f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ func TestRewriteVisitValueSliceContainer(t *testing.T) {
leaf2 := &Leaf{2}
leaf3 := &Leaf{3}
leaf4 := &Leaf{4}
container := ValueSliceContainer{ASTElements: []AST{leaf1, leaf2}, ASTImplementationElements: []*Leaf{leaf3, leaf4}}
ls := LeafSlice{leaf3, leaf4}
container := ValueSliceContainer{ASTElements: []AST{leaf1, leaf2}, ASTImplementationElements: ls}
containerContainer := ValueSliceContainer{ASTElements: []AST{container}}

tv := &rewriteTestVisitor{}
Expand All @@ -119,10 +120,12 @@ func TestRewriteVisitValueSliceContainer(t *testing.T) {
Post{leaf1},
Pre{leaf2},
Post{leaf2},
Pre{ls},
Pre{leaf3},
Post{leaf3},
Pre{leaf4},
Post{leaf4},
Post{ls},
Post{container},
Post{containerContainer},
})
Expand Down Expand Up @@ -402,6 +405,7 @@ func (tv *rewriteTestVisitor) assertEquals(t *testing.T, expected []step) {
expectedSize := len(expected)
for i, step := range tv.walk {
t.Run(fmt.Sprintf("step %d", i), func(t *testing.T) {
t.Helper()
if expectedSize <= i {
t.Fatalf("❌️ - Expected less elements %v", tv.walk[i:])
} else {
Expand Down
4 changes: 3 additions & 1 deletion go/tools/asthelpergen/integration/integration_visit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ func TestVisitValueSliceContainer(t *testing.T) {
leaf2 := &Leaf{2}
leaf3 := &Leaf{3}
leaf4 := &Leaf{4}
container := ValueSliceContainer{ASTElements: []AST{leaf1, leaf2}, ASTImplementationElements: []*Leaf{leaf3, leaf4}}
ls := LeafSlice{leaf3, leaf4}
container := ValueSliceContainer{ASTElements: []AST{leaf1, leaf2}, ASTImplementationElements: ls}
containerContainer := ValueSliceContainer{ASTElements: []AST{container}}

tv := &testVisitor{}
Expand All @@ -113,6 +114,7 @@ func TestVisitValueSliceContainer(t *testing.T) {
container,
leaf1,
leaf2,
ls,
leaf3,
leaf4,
})
Expand Down

0 comments on commit 59c422f

Please sign in to comment.