1
0
mirror of https://github.com/rclone/rclone.git synced 2025-06-14 22:15:26 +02:00

encoder: add edge control characters and fix edge test generation

This commit is contained in:
Fabian Möller
2019-05-17 15:41:38 +02:00
committed by Nick Craig-Wood
parent 6ba08b8612
commit f0c2249086
4 changed files with 10706 additions and 880 deletions

View File

@ -45,6 +45,22 @@ func TestEncodeSingleMaskEdge(t *testing.T) {
}
}
func TestEncodeDoubleMaskEdge(t *testing.T) {
for i, tc := range testCasesDoubleEdge {
e := MultiEncoder(tc.mask)
t.Run(strconv.FormatInt(int64(i), 10), func(t *testing.T) {
got := e.Encode(tc.in)
if got != tc.out {
t.Errorf("Encode(%q) want %q got %q", tc.in, tc.out, got)
}
got2 := e.Decode(got)
if got2 != tc.in {
t.Errorf("Decode(%q) want %q got %q", got, tc.in, got2)
}
})
}
}
func TestEncodeInvalidUnicode(t *testing.T) {
for i, tc := range []testCase{
{