Skip to content

Commit

Permalink
unbreak zero_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
mcy committed Jan 9, 2025
1 parent ffa3a70 commit 25a1c06
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion experimental/ast/zero_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,17 @@ func testZero[Node report.Spanner](t *testing.T) {
continue
}

assert.Zero(t, r.Interface(), "non-zero return #%d %#v of %T.%s", i, r, z, m.Name)
got := r.Interface()
if r.Type().Kind() != reflect.Pointer {
switch v := got.(type) {
case interface{ IsZero() bool }:
got = !v.IsZero()
case interface{ Len() int }:
got = v.Len()
}
}

assert.Zero(t, got, "non-zero return #%d %#v of %T.%s", i, r, z, m.Name)
}
}
})
Expand Down

0 comments on commit 25a1c06

Please sign in to comment.