1 // Copyright 2016 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.
11 "golang.org/x/text/internal/gen"
12 "golang.org/x/text/internal/testtext"
13 "golang.org/x/text/internal/ucd"
16 func TestTables(t *testing.T) {
17 testtext.SkipIfNotLong(t)
19 lookup := func(r rune) info {
20 v, _ := trie.lookupString(string(r))
24 ucd.Parse(gen.OpenUnicodeFile("idna", "", "IdnaMappingTable.txt"), func(p *ucd.Parser) {
27 if got, want := x.category(), catFromEntry(p); got != want {
28 t.Errorf("%U:category: got %x; want %x", r, got, want)
33 case "mapped", "disallowed_STD3_mapped", "deviation":
36 if x.isMapped() != mapped {
37 t.Errorf("%U:isMapped: got %v; want %v", r, x.isMapped(), mapped)
42 want := string(p.Runes(2))
43 got := string(x.appendMapping(nil, string(r)))
45 t.Errorf("%U:mapping: got %+q; want %+q", r, got, want)
51 wantMark := unicode.In(r, unicode.Mark)
52 gotMark := x.isModifier()
53 if gotMark != wantMark {
54 t.Errorf("IsMark(%U) = %v; want %v", r, gotMark, wantMark)
58 ucd.Parse(gen.OpenUCDFile("UnicodeData.txt"), func(p *ucd.Parser) {
61 got := x.isViramaModifier()
64 want := p.Int(ucd.CanonicalCombiningClass) == cccVirama
66 t.Errorf("IsVirama(%U) = %v; want %v", r, got, want)
70 ucd.Parse(gen.OpenUCDFile("extracted/DerivedJoiningType.txt"), func(p *ucd.Parser) {
77 want := joinType[p.String(1)]
79 t.Errorf("JoinType(%U) = %x; want %x", r, got, want)