Add capitalization changes to integration tests
This commit is contained in:
parent
aee40316f8
commit
dedca59ac9
17
test/util.go
17
test/util.go
@ -23,6 +23,7 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
"unicode"
|
||||||
|
|
||||||
"github.com/syncthing/syncthing/internal/osutil"
|
"github.com/syncthing/syncthing/internal/osutil"
|
||||||
"github.com/syncthing/syncthing/internal/symlinks"
|
"github.com/syncthing/syncthing/internal/symlinks"
|
||||||
@ -165,6 +166,22 @@ func alterFiles(dir string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Change capitalization
|
||||||
|
case r == 2 && comps > 3 && rand.Float64() < 0.2:
|
||||||
|
base := []rune(filepath.Base(path))
|
||||||
|
for i, r := range base {
|
||||||
|
if rand.Float64() < 0.5 {
|
||||||
|
base[i] = unicode.ToLower(r)
|
||||||
|
} else {
|
||||||
|
base[i] = unicode.ToUpper(r)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
err = os.Rename(path, strings.Replace(path, filepath.Base(path), string(base), 1))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Switch between files and directories
|
||||||
case r == 2 && comps > 3 && rand.Float64() < 0.2:
|
case r == 2 && comps > 3 && rand.Float64() < 0.2:
|
||||||
if !info.Mode().IsRegular() {
|
if !info.Mode().IsRegular() {
|
||||||
err = removeAll(path)
|
err = removeAll(path)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user