File: unicode_test.go

package info (click to toggle)
golang-golang-x-text 0.29.0-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid
  • size: 41,608 kB
  • sloc: xml: 1,022; makefile: 6
file content (28 lines) | stat: -rw-r--r-- 721 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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)
		}
	})
}