summaryrefslogtreecommitdiff
path: root/libgo/go/go/format/format_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/go/format/format_test.go')
-rw-r--r--libgo/go/go/format/format_test.go23
1 files changed, 18 insertions, 5 deletions
diff --git a/libgo/go/go/format/format_test.go b/libgo/go/go/format/format_test.go
index 000c611aa25..b5817a5dd18 100644
--- a/libgo/go/go/format/format_test.go
+++ b/libgo/go/go/format/format_test.go
@@ -72,6 +72,7 @@ func TestSource(t *testing.T) {
}
// Test cases that are expected to fail are marked by the prefix "ERROR".
+// The formatted result must look the same as the input for successful tests.
var tests = []string{
// declaration lists
`import "go/format"`,
@@ -91,11 +92,23 @@ var tests = []string{
"\n\t\t\n\n\t\t\tx := 0\n\t\t\tconst s = `\n\t\tfoo\n`\n\n\n", // no indentation removed inside raw strings
// comments
- "i := 5 /* Comment */", // Issue 5551.
- "\ta()\n//line :1", // Issue 11276.
- "\t//xxx\n\ta()\n//line :2", // Issue 11276.
- "\ta() //line :1\n\tb()\n", // Issue 11276.
- "x := 0\n//line :1\n//line :2", // Issue 11276.
+ "/* Comment */",
+ "\t/* Comment */ ",
+ "\n/* Comment */ ",
+ "i := 5 /* Comment */", // issue #5551
+ "\ta()\n//line :1", // issue #11276
+ "\t//xxx\n\ta()\n//line :2", // issue #11276
+ "\ta() //line :1\n\tb()\n", // issue #11276
+ "x := 0\n//line :1\n//line :2", // issue #11276
+
+ // whitespace
+ "", // issue #11275
+ " ", // issue #11275
+ "\t", // issue #11275
+ "\t\t", // issue #11275
+ "\n", // issue #11275
+ "\n\n", // issue #11275
+ "\t\n", // issue #11275
// erroneous programs
"ERROR1 + 2 +",