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 <mpvl@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
diff --git a/internal/export/unicode/unicode_test.go b/internal/export/unicode/unicode_test.go
new file mode 100644
index 0000000..ce7ae2e
--- /dev/null
+++ b/internal/export/unicode/unicode_test.go
@@ -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)
+		}
+	})
+}