]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.typeparams] go/types: add missing test from dev.go2go
authorRob Findley <rfindley@google.com>
Thu, 4 Feb 2021 02:57:06 +0000 (21:57 -0500)
committerRobert Findley <rfindley@google.com>
Thu, 4 Feb 2021 14:19:10 +0000 (14:19 +0000)
errors_test.go was missed during merging. Add it.

Change-Id: I321f08ae16ca02586875e1c7776f5d78f8690b4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/289549
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/go/types/errors_test.go [new file with mode: 0644]

diff --git a/src/go/types/errors_test.go b/src/go/types/errors_test.go
new file mode 100644 (file)
index 0000000..fdbe07c
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package types
+
+import "testing"
+
+func TestStripAnnotations(t *testing.T) {
+       for _, test := range []struct {
+               in, want string
+       }{
+               {"", ""},
+               {"   ", "   "},
+               {"foo", "foo"},
+               {"foo₀", "foo"},
+               {"foo(T₀)", "foo(T)"},
+               {"#foo(T₀)", "foo(T)"},
+       } {
+               got := stripAnnotations(test.in)
+               if got != test.want {
+                       t.Errorf("%q: got %q; want %q", test.in, got, test.want)
+               }
+       }
+}