Skip to content

Commit

Permalink
x/tools/go/internal/gcimporter: exclude a file from TestImportTypepar…
Browse files Browse the repository at this point in the history
…amTests

Matching change for the corresponding file in CL 353389.
To make the builds pass for now.

For golang/go#48424.

Change-Id: Id66837957ffec4e4b19faa0337a7587ea8bd6125
Reviewed-on: https://go-review.googlesource.com/c/tools/+/353395
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
  • Loading branch information
griesemer committed Oct 1, 2021
1 parent 1c35f2a commit e89823e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions go/internal/gcimporter/iexport_go118_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,34 @@ func TestImportTypeparamTests(t *testing.T) {
t.Skip("unified export data format is currently unsupported")
}

skip := map[string]string{
"issue48424.go": "go/types support missing", // TODO: need to implement this if #48424 is accepted
}

for _, entry := range list {
if entry.IsDir() || !strings.HasSuffix(entry.Name(), ".go") {
// For now, only consider standalone go files.
continue
}

t.Run(entry.Name(), func(t *testing.T) {
if reason, ok := skip[entry.Name()]; ok {
t.Skip(reason)
}

filename := filepath.Join(rootDir, entry.Name())
src, err := os.ReadFile(filename)
if err != nil {
t.Fatal(err)
}

if !bytes.HasPrefix(src, []byte("// run")) && !bytes.HasPrefix(src, []byte("// compile")) {
// We're bypassing the logic of run.go here, so be conservative about
// the files we consider in an attempt to make this test more robust to
// changes in test/typeparams.
t.Skipf("not detected as a run test")
}

testExportSrc(t, src)
})
}
Expand Down

0 comments on commit e89823e

Please sign in to comment.