mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.typeparams] cmd/compile/internal/syntax: add type parameter tests
The file endings are not .go so that gofmt leaves these files alone. They are also not .src to distinguish them from regular go source tests. Change-Id: I741f5c037bad1ea9d6f7fda3673487d0be631350 Reviewed-on: https://go-review.googlesource.com/c/go/+/261219 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
b627988b0c
commit
7668f02dec
10 changed files with 1341 additions and 2 deletions
|
|
@ -29,7 +29,24 @@ func TestParse(t *testing.T) {
|
|||
ParseFile(*src_, func(err error) { t.Error(err) }, nil, 0)
|
||||
}
|
||||
|
||||
func TestStdLib(t *testing.T) {
|
||||
func TestParseGo2(t *testing.T) {
|
||||
dir := filepath.Join(testdata, "go2")
|
||||
list, err := ioutil.ReadDir(dir)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, fi := range list {
|
||||
name := fi.Name()
|
||||
if !fi.IsDir() && !strings.HasPrefix(name, ".") {
|
||||
ParseFile(filepath.Join(dir, name), func(err error) { t.Error(err) }, nil, AllowGenerics)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestStdLib(t *testing.T) { testStdLib(t, 0) }
|
||||
func TestStdLibGeneric(t *testing.T) { testStdLib(t, AllowGenerics) }
|
||||
|
||||
func testStdLib(t *testing.T, mode Mode) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping test in short mode")
|
||||
}
|
||||
|
|
@ -68,7 +85,7 @@ func TestStdLib(t *testing.T) {
|
|||
if debug {
|
||||
fmt.Printf("parsing %s\n", filename)
|
||||
}
|
||||
ast, err := ParseFile(filename, nil, nil, 0)
|
||||
ast, err := ParseFile(filename, nil, nil, mode)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue