1 // Copyright 2015 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
10 "golang.org/x/text/runes"
13 // Compile-time regression test to ensure that Class is a Set
14 var _ runes.Set = (*class)(nil)
16 // Ensure that certain characters are (or are not) in the identifer class.
17 func TestClassContains(t *testing.T) {
27 allowed: []rune("Aa0\u0021\u007e\u00df\u3007"),
28 disallowed: []rune("\u2150\u2100\u2200\u3164\u2190\u2600\u303b\u1e9b"),
33 allowed: []rune("Aa0\u0021\u007e\u00df\u3007 \u2150\u2100\u2200\u2190\u2600\u1e9b"),
34 disallowed: []rune("\u3164\u303b"),
38 for _, rt := range tests {
39 for _, r := range rt.allowed {
40 if !rt.class.Contains(r) {
41 t.Errorf("Class %s should contain %U", rt.name, r)
44 for _, r := range rt.disallowed {
45 if rt.class.Contains(r) {
46 t.Errorf("Class %s should not contain %U", rt.name, r)