aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Tsai <joetsai@digital-static.net>2019-08-16 10:42:18 -0700
committerJoe Tsai <thebrokentoaster@gmail.com>2019-08-16 19:54:55 +0000
commitbb5441de4893c0802e3445250fbcc13c7b8e105c (patch)
treea6b9f0784763944813b05ef159b78df3ea27239d
parent4983a0b75b40448d3245811ddcf682a9c86fc975 (diff)
downloadgo-bb5441de4893c0802e3445250fbcc13c7b8e105c.tar.gz
go-bb5441de4893c0802e3445250fbcc13c7b8e105c.zip
cmd/gofmt: update TestRewrite to avoid future regressions
CL 162337 changed go/ast to better handle block comments, but was reverted because it introduced an off-by-one bug. This CL adds a test case to enforce the correct behavior so that future changes do not break this again. Updates #18929 Updates #33538 Change-Id: I2d25c139d007f8db1091b7a48b1dd20c584e2699 Reviewed-on: https://go-review.googlesource.com/c/go/+/190523 Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
-rw-r--r--src/cmd/gofmt/testdata/import.golden5
-rw-r--r--src/cmd/gofmt/testdata/import.input3
2 files changed, 8 insertions, 0 deletions
diff --git a/src/cmd/gofmt/testdata/import.golden b/src/cmd/gofmt/testdata/import.golden
index 51d7be79df..29bdc9baf4 100644
--- a/src/cmd/gofmt/testdata/import.golden
+++ b/src/cmd/gofmt/testdata/import.golden
@@ -10,6 +10,11 @@ import (
import (
"fmt"
+ "math"
+)
+
+import (
+ "fmt"
"math"
diff --git a/src/cmd/gofmt/testdata/import.input b/src/cmd/gofmt/testdata/import.input
index 9a4b09dbf9..78ab4f6544 100644
--- a/src/cmd/gofmt/testdata/import.input
+++ b/src/cmd/gofmt/testdata/import.input
@@ -8,6 +8,9 @@ import (
"io"
)
+import("fmt"
+"math")
+
import (
"fmt"