Update Go library to r60.

From-SVN: r178910
This commit is contained in:
Ian Lance Taylor 2011-09-16 15:47:21 +00:00
parent 5548ca3540
commit adb0401dac
718 changed files with 58911 additions and 30469 deletions

View file

@ -212,6 +212,10 @@ var caseTest = []caseT{
{UpperCase, 0x10450, 0x10450},
{LowerCase, 0x10450, 0x10450},
{TitleCase, 0x10450, 0x10450},
// Non-letters with case.
{LowerCase, 0x2161, 0x2171},
{UpperCase, 0x0345, 0x0399},
}
func TestIsLetter(t *testing.T) {
@ -323,7 +327,7 @@ func TestIsSpace(t *testing.T) {
// Check that the optimizations for IsLetter etc. agree with the tables.
// We only need to check the Latin-1 range.
func TestLetterOptimizations(t *testing.T) {
for i := 0; i < 0x100; i++ {
for i := 0; i <= MaxLatin1; i++ {
if Is(Letter, i) != IsLetter(i) {
t.Errorf("IsLetter(U+%04X) disagrees with Is(Letter)", i)
}
@ -376,3 +380,49 @@ func TestTurkishCase(t *testing.T) {
}
}
}
var simpleFoldTests = []string{
// SimpleFold could order its returned slices in any order it wants,
// but we know it orders them in increasing order starting at in
// and looping around from MaxRune to 0.
// Easy cases.
"Aa",
"aA",
"δΔ",
"Δδ",
// ASCII special cases.
"Kk",
"kK",
"Kk",
"Ssſ",
"sſS",
"ſSs",
// Non-ASCII special cases.
"ρϱΡ",
"ϱΡρ",
"Ρρϱ",
"ͅΙιι",
"Ιιιͅ",
"ιιͅΙ",
"ιͅΙι",
// Extra special cases: has lower/upper but no case fold.
"İ",
"ı",
}
func TestSimpleFold(t *testing.T) {
for _, tt := range simpleFoldTests {
cycle := []int(tt)
rune := cycle[len(cycle)-1]
for _, out := range cycle {
if r := SimpleFold(rune); r != out {
t.Errorf("SimpleFold(%#U) = %#U, want %#U", rune, r, out)
}
rune = out
}
}
}