From a284a61701f146bc9e626ac636f520102755ecbc Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sat, 16 Nov 2013 14:53:18 -0800 Subject: [PATCH] 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 --- astutil/imports_test.go | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/astutil/imports_test.go b/astutil/imports_test.go index b0bb00e16c0..27f699794a5 100644 --- a/astutil/imports_test.go +++ b/astutil/imports_test.go @@ -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,7 +199,11 @@ 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 { - t.Errorf("%s:\ngot: %s\nwant: %s", test.name, 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) + } } } }