1
0
mirror of https://github.com/golang/go synced 2024-11-18 22:55:23 -07:00

astutil: add new broken test

Tests will still pass because it's marked as known broken,
but it will log the unexpected for now.

R=golang-dev, crawshaw
CC=golang-dev
https://golang.org/cl/27330043
This commit is contained in:
Brad Fitzpatrick 2013-11-16 14:53:18 -08:00
parent e785f050b6
commit a284a61701

View File

@ -35,6 +35,7 @@ type test struct {
pkg string
in string
out string
broken bool // known broken
}
var addTests = []test{
@ -168,6 +169,27 @@ import (
fmtpkg "fmt"
"os"
)
`,
},
{
broken: true,
name: "struct comment",
pkg: "time",
in: `package main
// This is a comment before a struct.
type T struct {
t time.Time
}
`,
out: `package main
import "time"
// This is a comment before a struct.
type T struct {
t time.Time
}
`,
},
}
@ -177,9 +199,13 @@ func TestAddImport(t *testing.T) {
file := parse(t, test.name, test.in)
AddNamedImport(file, test.renamedPkg, test.pkg)
if got := print(t, test.name, file); got != test.out {
if test.broken {
t.Logf("%s is known broken:\ngot: %s\nwant: %s", test.name, got, test.out)
} else {
t.Errorf("%s:\ngot: %s\nwant: %s", test.name, got, test.out)
}
}
}
}
func TestDoubleAddImport(t *testing.T) {