MCPcopy
hub / github.com/minio/minio-go / TestEncodePath

Function TestEncodePath

pkg/s3utils/utils_test.go:340–363  ·  view source on GitHub ↗

Tests validate the URL path encoder.

(t *testing.T)

Source from the content-addressed store, hash-verified

338
339// Tests validate the URL path encoder.
340func 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.
366func TestIsValidBucketName(t *testing.T) {

Callers

nothing calls this directly

Calls 1

EncodePathFunction · 0.85

Tested by

no test coverage detected