mirror of
https://github.com/rclone/rclone.git
synced 2024-11-28 11:16:45 +08:00
cdde8fa75a
* Fix errcheck and golint warnings * Remove unused constants and fix comments * Parse error responses properly * Fix Open with RangeOption * Fix Move, Copy and DirMove * Implement DirCacheFlush * Check interfaces are correct * Remove debugs and update overview * Correct feature flags * Pare replacement characters down to the minimum set * Add to the integration tests
29 lines
818 B
Go
29 lines
818 B
Go
package opendrive
|
||
|
||
import "testing"
|
||
|
||
func TestReplace(t *testing.T) {
|
||
for _, test := range []struct {
|
||
in string
|
||
out string
|
||
}{
|
||
{"", ""},
|
||
{"abc 123", "abc 123"},
|
||
{`\*<>?:|#%".~`, `\*<>?:|#%".~`},
|
||
{`\*<>?:|#%".~/\*<>?:|#%".~`, `\*<>?:|#%".~/\*<>?:|#%".~`},
|
||
{" leading space", "␠leading space"},
|
||
{" path/ leading spaces", "␠path/␠ leading spaces"},
|
||
{"trailing space ", "trailing space␠"},
|
||
{"trailing spaces /path ", "trailing spaces ␠/path␠"},
|
||
} {
|
||
got := replaceReservedChars(test.in)
|
||
if got != test.out {
|
||
t.Errorf("replaceReservedChars(%q) want %q got %q", test.in, test.out, got)
|
||
}
|
||
got2 := restoreReservedChars(got)
|
||
if got2 != test.in {
|
||
t.Errorf("restoreReservedChars(%q) want %q got %q", got, test.in, got2)
|
||
}
|
||
}
|
||
}
|