fstests: only test with ASCII uppercase for case insensitive tests

Upper/lower case for multilingual is provider dependent so we don't go
there in the tests.
This commit is contained in:
Nick Craig-Wood 2021-01-27 14:22:10 +00:00
parent 4323ff8a63
commit 92b9dabf3c
1 changed files with 16 additions and 3 deletions

View File

@ -307,6 +307,17 @@ func stringsContains(x string, ss []string) bool {
return false
}
// toUpperASCII returns a copy of the string s with all Unicode
// letters mapped to their upper case.
func toUpperASCII(s string) string {
return strings.Map(func(r rune) rune {
if 'a' <= r && r <= 'z' {
r -= 'a' - 'A'
}
return r
}, s)
}
// Run runs the basic integration tests for a remote using the options passed in.
//
// They are structured in a hierarchical way so that dependencies for the tests can be created.
@ -1008,10 +1019,12 @@ func Run(t *testing.T, opt *Opt) {
if !f.Features().CaseInsensitive {
t.Skip("Not Case Insensitive")
}
obj := findObject(ctx, t, f, strings.ToUpper(file1.Path))
obj := findObject(ctx, t, f, toUpperASCII(file1.Path))
file1.Check(t, obj, f.Precision())
obj = findObject(ctx, t, f, strings.ToUpper(file2.Path))
file2.Check(t, obj, f.Precision())
t.Run("Dir", func(t *testing.T) {
obj := findObject(ctx, t, f, toUpperASCII(file2.Path))
file2.Check(t, obj, f.Precision())
})
})
// TestFsListFile1and2 tests two files present