aboutsummaryrefslogtreecommitdiff
path: root/src/go/types/exprstring_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/go/types/exprstring_test.go')
-rw-r--r--src/go/types/exprstring_test.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/go/types/exprstring_test.go b/src/go/types/exprstring_test.go
index 51102881c9..a67f6a978a 100644
--- a/src/go/types/exprstring_test.go
+++ b/src/go/types/exprstring_test.go
@@ -27,6 +27,40 @@ var testExprs = []testEntry{
{"func(x int) complex128 {}", "(func(x int) complex128 literal)"},
{"[]int{1, 2, 3}", "([]int literal)"},
+ // type expressions
+ dup("[1 << 10]byte"),
+ dup("[]int"),
+ dup("*int"),
+ dup("struct{x int}"),
+ dup("func()"),
+ dup("func(int, float32) string"),
+ dup("interface{m()}"),
+ dup("interface{m() string; n(x int)}"),
+ dup("interface{type int}"),
+
+ // The following exprs do not get formatted correctly: each element in the
+ // type list is printed on a separate line. This is left as a placeholder
+ // until type lists are removed.
+ // TODO(rfindley): remove this once type lists are gone.
+ // dup("interface{type int, float64, string}"),
+ // dup("interface{type int; m()}"),
+ // dup("interface{type int, float64, string; m() string; n(x int)}"),
+ dup("map[string]int"),
+ dup("chan E"),
+ dup("<-chan E"),
+ dup("chan<- E"),
+
+ // new interfaces
+ dup("interface{int}"),
+ dup("interface{~int}"),
+ dup("interface{~int}"),
+ dup("interface{int | string}"),
+ dup("interface{~int | ~string; float64; m()}"),
+
+ // See above.
+ // dup("interface{type a, b, c; ~int | ~string; float64; m()}"),
+ dup("interface{~T[int, string] | string}"),
+
// non-type expressions
dup("(x)"),
dup("x.f"),