| 1 |
// Copyright 2019 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. |
| 4 |
|
| 5 |
package unicode |
| 6 |
|
| 7 |
import ( |
| 8 |
"testing" |
| 9 |
"unicode" |
| 10 |
|
| 11 |
"golang.org/x/text/internal/gen" |
| 12 |
"golang.org/x/text/internal/testtext" |
| 13 |
"golang.org/x/text/internal/ucd" |
| 14 |
) |
| 15 |
|
| 16 |
// TestScripts tests for all runes whether they are included in the correct |
| 17 |
// script and, indirectly, whether each script exists. |
| 18 |
func TestScripts(t *testing.T) { |
| 19 |
testtext.SkipIfNotLong(t) |
| 20 |
|
| 21 |
ucd.Parse(gen.OpenUCDFile("Scripts.txt"), func(p *ucd.Parser) { |
| 22 |
r := p.Rune(0) |
| 23 |
script := p.String(1) |
| 24 |
if !unicode.Is(unicode.Scripts[script], r) { |
| 25 |
t.Errorf("%U: not in script %q", r, script) |
| 26 |
} |
| 27 |
}) |
| 28 |
} |