diff options
Diffstat (limited to 'src/pkg/unicode/script_test.go')
-rw-r--r-- | src/pkg/unicode/script_test.go | 201 |
1 files changed, 100 insertions, 101 deletions
diff --git a/src/pkg/unicode/script_test.go b/src/pkg/unicode/script_test.go index 64e205ccf..c212e3335 100644 --- a/src/pkg/unicode/script_test.go +++ b/src/pkg/unicode/script_test.go @@ -5,8 +5,8 @@ package unicode_test import ( - "testing"; - . "unicode"; + "testing"; + . "unicode"; ) type T struct { @@ -16,92 +16,91 @@ type T struct { // Hand-chosen tests from Unicode 5.1.0, mostly to discover when new // scripts and categories arise. -var inTest = []T { - T{0x06e2, "Arabic"}, - T{0x0567, "Armenian"}, - T{0x1b37, "Balinese"}, - T{0x09c2, "Bengali"}, - T{0x3115, "Bopomofo"}, - T{0x282d, "Braille"}, - T{0x1a1a, "Buginese"}, - T{0x1747, "Buhid"}, - T{0x156d, "Canadian_Aboriginal"}, - T{0x102a9, "Carian"}, - T{0xaa4d, "Cham"}, - T{0x13c2, "Cherokee"}, - T{0x0020, "Common"}, - T{0x1d4a5, "Common"}, - T{0x2cfc, "Coptic"}, - T{0x12420, "Cuneiform"}, - T{0x1080c, "Cypriot"}, - T{0xa663, "Cyrillic"}, - T{0x10430, "Deseret"}, - T{0x094a, "Devanagari"}, - T{0x1271, "Ethiopic"}, - T{0x10fc, "Georgian"}, - T{0x2c40, "Glagolitic"}, - T{0x10347, "Gothic"}, - T{0x03ae, "Greek"}, - T{0x0abf, "Gujarati"}, - T{0x0a24, "Gurmukhi"}, - T{0x3028, "Han"}, - T{0x11b8, "Hangul"}, - T{0x1727, "Hanunoo"}, - T{0x05a0, "Hebrew"}, - T{0x3058, "Hiragana"}, - T{0x20e6, "Inherited"}, - T{0x0cbd, "Kannada"}, - T{0x30a6, "Katakana"}, - T{0xa928, "Kayah_Li"}, - T{0x10a11, "Kharoshthi"}, - T{0x17c6, "Khmer"}, - T{0x0eaa, "Lao"}, - T{0x1d79, "Latin"}, - T{0x1c10, "Lepcha"}, - T{0x1930, "Limbu"}, - T{0x1003c, "Linear_B"}, - T{0x10290, "Lycian"}, - T{0x10930, "Lydian"}, - T{0x0d42, "Malayalam"}, - T{0x1822, "Mongolian"}, - T{0x104c, "Myanmar"}, - T{0x19c3, "New_Tai_Lue"}, - T{0x07f8, "Nko"}, - T{0x169b, "Ogham"}, - T{0x1c6a, "Ol_Chiki"}, - T{0x10310, "Old_Italic"}, - T{0x103c9, "Old_Persian"}, - T{0x0b3e, "Oriya"}, - T{0x10491, "Osmanya"}, - T{0xa860, "Phags_Pa"}, - T{0x10918, "Phoenician"}, - T{0xa949, "Rejang"}, - T{0x16c0, "Runic"}, - T{0xa892, "Saurashtra"}, - T{0x10463, "Shavian"}, - T{0x0dbd, "Sinhala"}, - T{0x1ba3, "Sundanese"}, - T{0xa803, "Syloti_Nagri"}, - T{0x070f, "Syriac"}, - T{0x170f, "Tagalog"}, - T{0x176f, "Tagbanwa"}, - T{0x1972, "Tai_Le"}, - T{0x0bbf, "Tamil"}, - T{0x0c55, "Telugu"}, - T{0x07a7, "Thaana"}, - T{0x0e46, "Thai"}, - T{0x0f36, "Tibetan"}, - T{0x2d55, "Tifinagh"}, - T{0x10388, "Ugaritic"}, - T{0xa60e, "Vai"}, - T{0xa216, "Yi"}, +var inTest = []T{ + T{0x06e2, "Arabic"}, + T{0x0567, "Armenian"}, + T{0x1b37, "Balinese"}, + T{0x09c2, "Bengali"}, + T{0x3115, "Bopomofo"}, + T{0x282d, "Braille"}, + T{0x1a1a, "Buginese"}, + T{0x1747, "Buhid"}, + T{0x156d, "Canadian_Aboriginal"}, + T{0x102a9, "Carian"}, + T{0xaa4d, "Cham"}, + T{0x13c2, "Cherokee"}, + T{0x0020, "Common"}, + T{0x1d4a5, "Common"}, + T{0x2cfc, "Coptic"}, + T{0x12420, "Cuneiform"}, + T{0x1080c, "Cypriot"}, + T{0xa663, "Cyrillic"}, + T{0x10430, "Deseret"}, + T{0x094a, "Devanagari"}, + T{0x1271, "Ethiopic"}, + T{0x10fc, "Georgian"}, + T{0x2c40, "Glagolitic"}, + T{0x10347, "Gothic"}, + T{0x03ae, "Greek"}, + T{0x0abf, "Gujarati"}, + T{0x0a24, "Gurmukhi"}, + T{0x3028, "Han"}, + T{0x11b8, "Hangul"}, + T{0x1727, "Hanunoo"}, + T{0x05a0, "Hebrew"}, + T{0x3058, "Hiragana"}, + T{0x20e6, "Inherited"}, + T{0x0cbd, "Kannada"}, + T{0x30a6, "Katakana"}, + T{0xa928, "Kayah_Li"}, + T{0x10a11, "Kharoshthi"}, + T{0x17c6, "Khmer"}, + T{0x0eaa, "Lao"}, + T{0x1d79, "Latin"}, + T{0x1c10, "Lepcha"}, + T{0x1930, "Limbu"}, + T{0x1003c, "Linear_B"}, + T{0x10290, "Lycian"}, + T{0x10930, "Lydian"}, + T{0x0d42, "Malayalam"}, + T{0x1822, "Mongolian"}, + T{0x104c, "Myanmar"}, + T{0x19c3, "New_Tai_Lue"}, + T{0x07f8, "Nko"}, + T{0x169b, "Ogham"}, + T{0x1c6a, "Ol_Chiki"}, + T{0x10310, "Old_Italic"}, + T{0x103c9, "Old_Persian"}, + T{0x0b3e, "Oriya"}, + T{0x10491, "Osmanya"}, + T{0xa860, "Phags_Pa"}, + T{0x10918, "Phoenician"}, + T{0xa949, "Rejang"}, + T{0x16c0, "Runic"}, + T{0xa892, "Saurashtra"}, + T{0x10463, "Shavian"}, + T{0x0dbd, "Sinhala"}, + T{0x1ba3, "Sundanese"}, + T{0xa803, "Syloti_Nagri"}, + T{0x070f, "Syriac"}, + T{0x170f, "Tagalog"}, + T{0x176f, "Tagbanwa"}, + T{0x1972, "Tai_Le"}, + T{0x0bbf, "Tamil"}, + T{0x0c55, "Telugu"}, + T{0x07a7, "Thaana"}, + T{0x0e46, "Thai"}, + T{0x0f36, "Tibetan"}, + T{0x2d55, "Tifinagh"}, + T{0x10388, "Ugaritic"}, + T{0xa60e, "Vai"}, + T{0xa216, "Yi"}, } -var outTest = []T { // not really worth being thorough - T{0x20, "Telugu"} -} +var outTest = []T{ // not really worth being thorough +T{0x20, "Telugu"}} -var inCategoryTest = []T { +var inCategoryTest = []T{ T{0x0081, "Cc"}, T{0x17b4, "Cf"}, T{0xf0000, "Co"}, @@ -134,7 +133,7 @@ var inCategoryTest = []T { T{0x04aa, "letter"}, } -var inPropTest = []T { +var inPropTest = []T{ T{0x0046, "ASCII_Hex_Digit"}, T{0x200F, "Bidi_Control"}, T{0x2212, "Dash"}, @@ -170,18 +169,18 @@ var inPropTest = []T { } func TestScripts(t *testing.T) { - notTested := make(map[string] bool); + notTested := make(map[string]bool); for k := range Scripts { - notTested[k] = true + notTested[k] = true; } for _, test := range inTest { if _, ok := Scripts[test.script]; !ok { - t.Fatal(test.script, "not a known script") + t.Fatal(test.script, "not a known script"); } if !Is(Scripts[test.script], test.rune) { t.Errorf("IsScript(%#x, %s) = false, want true\n", test.rune, test.script); } - notTested[test.script] = false, false + notTested[test.script] = false, false; } for _, test := range outTest { if Is(Scripts[test.script], test.rune) { @@ -189,44 +188,44 @@ func TestScripts(t *testing.T) { } } for k := range notTested { - t.Error("not tested:", k) + t.Error("not tested:", k); } } func TestCategories(t *testing.T) { - notTested := make(map[string] bool); + notTested := make(map[string]bool); for k := range Categories { - notTested[k] = true + notTested[k] = true; } for _, test := range inCategoryTest { if _, ok := Categories[test.script]; !ok { - t.Fatal(test.script, "not a known category") + t.Fatal(test.script, "not a known category"); } if !Is(Categories[test.script], test.rune) { t.Errorf("IsCategory(%#x, %s) = false, want true\n", test.rune, test.script); } - notTested[test.script] = false, false + notTested[test.script] = false, false; } for k := range notTested { - t.Error("not tested:", k) + t.Error("not tested:", k); } } func TestProperties(t *testing.T) { - notTested := make(map[string] bool); + notTested := make(map[string]bool); for k := range Properties { - notTested[k] = true + notTested[k] = true; } for _, test := range inPropTest { if _, ok := Properties[test.script]; !ok { - t.Fatal(test.script, "not a known prop") + t.Fatal(test.script, "not a known prop"); } if !Is(Properties[test.script], test.rune) { t.Errorf("IsCategory(%#x, %s) = false, want true\n", test.rune, test.script); } - notTested[test.script] = false, false + notTested[test.script] = false, false; } for k := range notTested { - t.Error("not tested:", k) + t.Error("not tested:", k); } } |