diff options
Diffstat (limited to 'src/pkg/unicode/letter_test.go')
-rw-r--r-- | src/pkg/unicode/letter_test.go | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/pkg/unicode/letter_test.go b/src/pkg/unicode/letter_test.go index 4c24ffc51..c4e26df58 100644 --- a/src/pkg/unicode/letter_test.go +++ b/src/pkg/unicode/letter_test.go @@ -376,3 +376,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. + "KkK", + "kKK", + "KKk", + "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 + } + } +} |