Tests validate the URL path encoder.
(t *testing.T)
| 338 | |
| 339 | // Tests validate the URL path encoder. |
| 340 | func TestEncodePath(t *testing.T) { |
| 341 | testCases := []struct { |
| 342 | // Input. |
| 343 | inputStr string |
| 344 | // Expected result. |
| 345 | result string |
| 346 | }{ |
| 347 | {"thisisthe%url", "thisisthe%25url"}, |
| 348 | {"本語", "%E6%9C%AC%E8%AA%9E"}, |
| 349 | {"本語.1", "%E6%9C%AC%E8%AA%9E.1"}, |
| 350 | {">123", "%3E123"}, |
| 351 | {"myurl#link", "myurl%23link"}, |
| 352 | {"space in url", "space%20in%20url"}, |
| 353 | {"url+path", "url%2Bpath"}, |
| 354 | {"url/path", "url/path"}, |
| 355 | } |
| 356 | |
| 357 | for i, testCase := range testCases { |
| 358 | result := EncodePath(testCase.inputStr) |
| 359 | if testCase.result != result { |
| 360 | t.Errorf("Test %d: Expected queryEncode result to be \"%s\", but found it to be \"%s\" instead", i+1, testCase.result, result) |
| 361 | } |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | // Tests validate the bucket name validator. |
| 366 | func TestIsValidBucketName(t *testing.T) { |
nothing calls this directly
no test coverage detected