forked from External/ergo
fix #2099
Add optional support for rfc1459 and rfc1459-strict casemappings
This commit is contained in:
parent
5ee32cda1c
commit
7772b55cab
5 changed files with 74 additions and 6 deletions
|
|
@ -279,3 +279,31 @@ func TestFoldASCIIInvalid(t *testing.T) {
|
|||
t.Errorf("control characters should be invalid in identifiers")
|
||||
}
|
||||
}
|
||||
|
||||
func TestFoldRFC1459(t *testing.T) {
|
||||
folder := func(str string) (string, error) {
|
||||
return foldRFC1459(str, false)
|
||||
}
|
||||
tester := func(first, second string, equal bool) {
|
||||
validFoldTester(first, second, equal, folder, t)
|
||||
}
|
||||
tester("shivaram", "SHIVARAM", true)
|
||||
tester("shivaram[a]", "shivaram{a}", true)
|
||||
tester("shivaram\\a]", "shivaram{a}", false)
|
||||
tester("shivaram\\a]", "shivaram|a}", true)
|
||||
tester("shivaram~a]", "shivaram^a}", true)
|
||||
}
|
||||
|
||||
func TestFoldRFC1459Strict(t *testing.T) {
|
||||
folder := func(str string) (string, error) {
|
||||
return foldRFC1459(str, true)
|
||||
}
|
||||
tester := func(first, second string, equal bool) {
|
||||
validFoldTester(first, second, equal, folder, t)
|
||||
}
|
||||
tester("shivaram", "SHIVARAM", true)
|
||||
tester("shivaram[a]", "shivaram{a}", true)
|
||||
tester("shivaram\\a]", "shivaram{a}", false)
|
||||
tester("shivaram\\a]", "shivaram|a}", true)
|
||||
tester("shivaram~a]", "shivaram^a}", false)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue