@@ -20,7 +20,6 @@ package s3utils
2020import (
2121 "errors"
2222 "net/url"
23- "reflect"
2423 "testing"
2524)
2625
@@ -298,81 +297,6 @@ func TestQueryEncode(t *testing.T) {
298297 }
299298}
300299
301- // Tests tag decode to map
302- func TestTagDecode (t * testing.T ) {
303- testCases := []struct {
304- // canonical input
305- canonicalInput string
306-
307- // Expected result.
308- resultMap map [string ]string
309- }{
310- {"k=thisisthe%25url" , map [string ]string {"k" : "thisisthe%url" }},
311- {"k=%E6%9C%AC%E8%AA%9E" , map [string ]string {"k" : "本語" }},
312- {"k=%E6%9C%AC%E8%AA%9E.1" , map [string ]string {"k" : "本語.1" }},
313- {"k=%3E123" , map [string ]string {"k" : ">123" }},
314- {"k=myurl%23link" , map [string ]string {"k" : "myurl#link" }},
315- {"k=space%20in%20url" , map [string ]string {"k" : "space in url" }},
316- {"k=url%2Bpath" , map [string ]string {"k" : "url+path" }},
317- {"k=url%2Fpath" , map [string ]string {"k" : "url/path" }},
318- }
319-
320- for _ , testCase := range testCases {
321- testCase := testCase
322- t .Run ("" , func (t * testing.T ) {
323- gotResult := TagDecode (testCase .canonicalInput )
324- if ! reflect .DeepEqual (testCase .resultMap , gotResult ) {
325- t .Errorf ("Expected %s, got %s" , testCase .resultMap , gotResult )
326- }
327- })
328- }
329- }
330-
331- // Tests tag encode function for user tags.
332- func TestTagEncode (t * testing.T ) {
333- testCases := []struct {
334- // Input.
335- inputMap map [string ]string
336- // Expected result.
337- result string
338- }{
339- {map [string ]string {
340- "k" : "thisisthe%url" ,
341- }, "k=thisisthe%25url" },
342- {map [string ]string {
343- "k" : "本語" ,
344- }, "k=%E6%9C%AC%E8%AA%9E" },
345- {map [string ]string {
346- "k" : "本語.1" ,
347- }, "k=%E6%9C%AC%E8%AA%9E.1" },
348- {map [string ]string {
349- "k" : ">123" ,
350- }, "k=%3E123" },
351- {map [string ]string {
352- "k" : "myurl#link" ,
353- }, "k=myurl%23link" },
354- {map [string ]string {
355- "k" : "space in url" ,
356- }, "k=space%20in%20url" },
357- {map [string ]string {
358- "k" : "url+path" ,
359- }, "k=url%2Bpath" },
360- {map [string ]string {
361- "k" : "url/path" ,
362- }, "k=url%2Fpath" },
363- }
364-
365- for _ , testCase := range testCases {
366- testCase := testCase
367- t .Run ("" , func (t * testing.T ) {
368- gotResult := TagEncode (testCase .inputMap )
369- if testCase .result != gotResult {
370- t .Errorf ("Expected %s, got %s" , testCase .result , gotResult )
371- }
372- })
373- }
374- }
375-
376300// Tests validate the URL path encoder.
377301func TestEncodePath (t * testing.T ) {
378302 testCases := []struct {
0 commit comments