TestSignV4TrimAll - tests the logic of TrimAll() function
(t *testing.T)
| 86 | |
| 87 | // TestSignV4TrimAll - tests the logic of TrimAll() function |
| 88 | func TestSignV4TrimAll(t *testing.T) { |
| 89 | testCases := []struct { |
| 90 | // Input. |
| 91 | inputStr string |
| 92 | // Expected result. |
| 93 | result string |
| 94 | }{ |
| 95 | {"本語", "本語"}, |
| 96 | {" abc ", "abc"}, |
| 97 | {" a b ", "a b"}, |
| 98 | {"a b ", "a b"}, |
| 99 | {"a b", "a b"}, |
| 100 | {"a b", "a b"}, |
| 101 | {" a b c ", "a b c"}, |
| 102 | {"a \t b c ", "a b c"}, |
| 103 | {"\"a \t b c ", "\"a b c"}, |
| 104 | {" \t\n\u000b\r\fa \t\n\u000b\r\f b \t\n\u000b\r\f c \t\n\u000b\r\f", "a b c"}, |
| 105 | } |
| 106 | |
| 107 | // Tests generated values from url encoded name. |
| 108 | for i, testCase := range testCases { |
| 109 | result := signV4TrimAll(testCase.inputStr) |
| 110 | if testCase.result != result { |
| 111 | t.Errorf("Test %d: Expected signV4TrimAll result to be \"%s\", but found it to be \"%s\" instead", i+1, testCase.result, result) |
| 112 | } |
| 113 | } |
| 114 | } |
nothing calls this directly
no test coverage detected