unicode_test.go 721 B

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