aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/syntax/printer_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/compile/internal/syntax/printer_test.go')
-rw-r--r--src/cmd/compile/internal/syntax/printer_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/syntax/printer_test.go b/src/cmd/compile/internal/syntax/printer_test.go
index 5c0fc776a1..a9969e610a 100644
--- a/src/cmd/compile/internal/syntax/printer_test.go
+++ b/src/cmd/compile/internal/syntax/printer_test.go
@@ -22,3 +22,20 @@ func TestPrint(t *testing.T) {
Fprint(os.Stdout, ast, true)
fmt.Println()
}
+
+func TestPrintString(t *testing.T) {
+ for _, want := range []string{
+ "package p",
+ "package p; type _ = int; type T1 = struct{}; type ( _ = *struct{}; T2 = float32 )",
+ // TODO(gri) expand
+ } {
+ ast, err := ParseBytes([]byte(want), nil, nil, 0)
+ if err != nil {
+ t.Error(err)
+ continue
+ }
+ if got := String(ast); got != want {
+ t.Errorf("%q: got %q", want, got)
+ }
+ }
+}