Skip to content

Commit 6ded0c4

Browse files
timothy-kinggopherbot
authored andcommitted
internal/gcexporter: cleanup test skipping in TestImportTypeparamTests
Cleaning up the documentation for skipping tests in 1.22 when gotypesalias=1. Change-Id: Iaf387ff83d2d771d3a0196d6ca26aa49516799dd Reviewed-on: https://go-review.googlesource.com/c/tools/+/615699 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Robert Findley <[email protected]> Auto-Submit: Tim King <[email protected]>
1 parent 66afc1a commit 6ded0c4

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

internal/gcimporter/gcimporter_test.go

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -172,22 +172,26 @@ func TestImportTypeparamTests(t *testing.T) {
172172
t.Skipf("gc-built packages not available (compiler = %s)", runtime.Compiler)
173173
}
174174

175-
testAliases(t, testImportTypeparamTests)
175+
testAliases(t, func(t *testing.T) {
176+
var skip map[string]string
177+
178+
// Add tests to skip.
179+
if testenv.Go1Point() == 22 && os.Getenv("GODEBUG") == aliasesOn {
180+
// The tests below can be skipped in 1.22 as gotypesalias=1 was experimental.
181+
// These do not need to be addressed.
182+
skip = map[string]string{
183+
"struct.go": "1.22 differences in formatting a *types.Alias",
184+
"issue50259.go": "1.22 cannot compile due to an understood types.Alias bug",
185+
}
186+
}
187+
testImportTypeparamTests(t, skip)
188+
})
176189
}
177190

178-
func testImportTypeparamTests(t *testing.T) {
191+
func testImportTypeparamTests(t *testing.T, skip map[string]string) {
179192
tmpdir := mktmpdir(t)
180193
defer os.RemoveAll(tmpdir)
181194

182-
// GoVersion -> GoDebug -> filename -> reason to skip
183-
skips := map[int]map[string]map[string]string{
184-
22: {aliasesOn: {
185-
"issue50259.go": "internal compiler error: unexpected types2.Invalid",
186-
"struct.go": "badly formatted expectation E[int]",
187-
}},
188-
}
189-
dbg, version := os.Getenv("GODEBUG"), testenv.Go1Point()
190-
191195
// Check go files in test/typeparam, except those that fail for a known
192196
// reason.
193197
rootDir := filepath.Join(runtime.GOROOT(), "test", "typeparam")
@@ -203,9 +207,8 @@ func testImportTypeparamTests(t *testing.T) {
203207
}
204208

205209
t.Run(entry.Name(), func(t *testing.T) {
206-
if reason := skips[version][dbg][entry.Name()]; reason != "" {
207-
t.Skipf("Skipping file %q with GODEBUG=%q due to %q at version 1.%d",
208-
entry.Name(), dbg, reason, version)
210+
if reason := skip[entry.Name()]; reason != "" {
211+
t.Skipf("Skipping due to %s", reason)
209212
}
210213

211214
filename := filepath.Join(rootDir, entry.Name())

0 commit comments

Comments
 (0)