Skip to content

Commit c40a8cc

Browse files
committed
internal/export/unicode: add scripts tests
This is to replace the script test in core that is used to verify the generation, but it interupts the flow of automation as they require manual upgrades. This brute-force approach is better anyway. Updates golang/go#27945 Change-Id: Ie7b8b257408c790c5547f03747fddc77c6c4ad68 Reviewed-on: https://go-review.googlesource.com/c/text/+/169638 Run-TryBot: Marcel van Lohuizen <[email protected]> Reviewed-by: Russ Cox <[email protected]>
1 parent e46505f commit c40a8cc

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
}

0 commit comments

Comments
 (0)