mirror of
https://github.com/restic/rest-server.git
synced 2025-12-07 09:36:13 -08:00
Vendor dependencies
This commit is contained in:
committed by
Zlatko Čalušić
parent
2f0a16d8b7
commit
6054876201
55
vendor/goji.io/pat/url_test.go
generated
vendored
Normal file
55
vendor/goji.io/pat/url_test.go
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
package pat
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var HexTexts = []struct {
|
||||
input byte
|
||||
ishex bool
|
||||
unhex byte
|
||||
}{
|
||||
{'0', true, 0},
|
||||
{'4', true, 4},
|
||||
{'a', true, 10},
|
||||
{'F', true, 15},
|
||||
{'h', false, 0},
|
||||
{'^', false, 0},
|
||||
}
|
||||
|
||||
func TestHex(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
for _, test := range HexTexts {
|
||||
if actual := ishex(test.input); actual != test.ishex {
|
||||
t.Errorf("ishex(%v) == %v, expected %v", test.input, actual, test.ishex)
|
||||
}
|
||||
if actual := unhex(test.input); actual != test.unhex {
|
||||
t.Errorf("unhex(%v) == %v, expected %v", test.input, actual, test.unhex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var UnescapeTests = []struct {
|
||||
input string
|
||||
err error
|
||||
output string
|
||||
}{
|
||||
{"hello", nil, "hello"},
|
||||
{"file%20one%26two", nil, "file one&two"},
|
||||
{"one/two%2fthree", nil, "one/two/three"},
|
||||
{"this%20is%0not%valid", url.EscapeError("%0n"), ""},
|
||||
}
|
||||
|
||||
func TestUnescape(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
for _, test := range UnescapeTests {
|
||||
if actual, err := unescape(test.input); err != test.err {
|
||||
t.Errorf("unescape(%q) had err %v, expected %q", test.input, err, test.err)
|
||||
} else if actual != test.output {
|
||||
t.Errorf("unescape(%q) = %q, expected %q)", test.input, actual, test.output)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user