Skip to content

Commit

Permalink
internal/export/unicode: add scripts tests
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
mpvl committed Apr 24, 2019
1 parent e46505f commit c40a8cc
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions internal/export/unicode/unicode_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2019 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 unicode

import (
"testing"
"unicode"

"golang.org/x/text/internal/gen"
"golang.org/x/text/internal/testtext"
"golang.org/x/text/internal/ucd"
)

// TestScripts tests for all runes whether they are included in the correct
// script and, indirectly, whether each script exists.
func TestScripts(t *testing.T) {
testtext.SkipIfNotLong(t)

ucd.Parse(gen.OpenUCDFile("Scripts.txt"), func(p *ucd.Parser) {
r := p.Rune(0)
script := p.String(1)
if !unicode.Is(unicode.Scripts[script], r) {
t.Errorf("%U: not in script %q", r, script)
}
})
}

0 comments on commit c40a8cc

Please sign in to comment.