Skip to content

Commit aaa56ec

Browse files
committed
internal/godoc: fix codec generation test
ast.BasicLit has a new field. While we figure out what to do with this, update the test to pass. Updates golang/go#76350 Change-Id: Iaffabd1335dd17143d08fcd677c0f4ed6296a50f Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/721800 Reviewed-by: Ethan Lee <[email protected]> Auto-Submit: Robert Findley <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> TryBot-Bypass: Robert Findley <[email protected]>
1 parent 519903f commit aaa56ec

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

internal/godoc/codec/generate_test.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ package codec
77
import (
88
"bytes"
99
"flag"
10-
"go/ast"
1110
"go/token"
1211
"io"
1312
"reflect"
@@ -46,7 +45,18 @@ func TestGoName(t *testing.T) {
4645
func TestGenerate(t *testing.T) {
4746
testGenerate(t, "slice", [][]int(nil))
4847
testGenerate(t, "map", map[string]bool(nil))
49-
testGenerate(t, "struct", ast.BasicLit{})
48+
testGenerate(t, "struct", BasicLit{})
49+
}
50+
51+
// Copy of ast.BasicLit before ValueEnd was added in golang/go#76031.
52+
// This largely preserves the previous test data.
53+
//
54+
// See also golang/go#76350: we should figure out what to do with new fields,
55+
// in general. In this case we can probably just safely skip the field.
56+
type BasicLit struct {
57+
ValuePos token.Pos // literal position
58+
Kind token.Token
59+
Value string
5060
}
5161

5262
func testGenerate(t *testing.T, name string, x any) {

internal/godoc/codec/testdata/struct.go

Lines changed: 10 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)