mirror of https://github.com/golang/go.git
go/types, types2: use new flag mechanims to handle importC test
Change-Id: I6f0cb850ee23184380c03a53c12425c350aa16e3 Reviewed-on: https://go-review.googlesource.com/c/go/+/393714 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
3395f74d86
commit
101d14e3b3
|
|
@ -130,6 +130,7 @@ func testFiles(t *testing.T, filenames []string, colDelta uint, manual bool) {
|
|||
var conf Config
|
||||
flags := flag.NewFlagSet("", flag.PanicOnError)
|
||||
flags.StringVar(&conf.GoVersion, "lang", "", "")
|
||||
flags.BoolVar(&conf.FakeImportC, "fakeImportC", false, "")
|
||||
if err := parseFlags(filenames[0], nil, flags); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
@ -156,10 +157,6 @@ func testFiles(t *testing.T, filenames []string, colDelta uint, manual bool) {
|
|||
}
|
||||
|
||||
// typecheck and collect typechecker errors
|
||||
// special case for importC.src
|
||||
if len(filenames) == 1 && strings.HasSuffix(filenames[0], "importC.src") {
|
||||
conf.FakeImportC = true
|
||||
}
|
||||
conf.Trace = manual && testing.Verbose()
|
||||
conf.Importer = defaultImporter()
|
||||
conf.Error = func(err error) {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
// -fakeImportC
|
||||
|
||||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
|
|
|||
|
|
@ -233,6 +233,7 @@ func testFiles(t *testing.T, sizes Sizes, filenames []string, srcs [][]byte, man
|
|||
conf.Sizes = sizes
|
||||
flags := flag.NewFlagSet("", flag.PanicOnError)
|
||||
flags.StringVar(&conf.GoVersion, "lang", "", "")
|
||||
flags.BoolVar(&conf.FakeImportC, "fakeImportC", false, "")
|
||||
if err := parseFlags(filenames[0], srcs[0], flags); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
@ -265,17 +266,10 @@ func testFiles(t *testing.T, sizes Sizes, filenames []string, srcs [][]byte, man
|
|||
}
|
||||
|
||||
// typecheck and collect typechecker errors
|
||||
// special case for importC.src
|
||||
if len(filenames) == 1 {
|
||||
if strings.HasSuffix(filenames[0], "importC.src") {
|
||||
conf.FakeImportC = true
|
||||
}
|
||||
}
|
||||
|
||||
conf.Importer = imp
|
||||
if imp == nil {
|
||||
conf.Importer = importer.Default()
|
||||
imp = importer.Default()
|
||||
}
|
||||
conf.Importer = imp
|
||||
conf.Error = func(err error) {
|
||||
if *haltOnError {
|
||||
defer panic(err)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
// -fakeImportC
|
||||
|
||||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
|
|
|||
Loading…
Reference in New Issue