CopyConditionKeyMap() is called and the result is validated.
(t *testing.T)
| 111 | |
| 112 | // CopyConditionKeyMap() is called and the result is validated. |
| 113 | func TestCopyConditionKeyMap(t *testing.T) { |
| 114 | emptyCondKeyMap := make(ConditionKeyMap) |
| 115 | nonEmptyCondKeyMap := make(ConditionKeyMap) |
| 116 | nonEmptyCondKeyMap.Add("s3:prefix", set.CreateStringSet("hello", "world")) |
| 117 | |
| 118 | testCases := []struct { |
| 119 | condKeyMap ConditionKeyMap |
| 120 | expectedResult string |
| 121 | }{ |
| 122 | // To test empty ConditionKeyMap. |
| 123 | {emptyCondKeyMap, `{}`}, |
| 124 | // To test non-empty ConditionKeyMap. |
| 125 | {nonEmptyCondKeyMap, `{"s3:prefix":["hello","world"]}`}, |
| 126 | } |
| 127 | |
| 128 | for _, testCase := range testCases { |
| 129 | condKeyMap := CopyConditionKeyMap(testCase.condKeyMap) |
| 130 | if data, err := json.Marshal(condKeyMap); err != nil { |
| 131 | t.Fatalf("Unable to marshal ConditionKeyMap to JSON, %s", err) |
| 132 | } else { |
| 133 | if string(data) != testCase.expectedResult { |
| 134 | t.Fatalf("case: %+v: expected: %s, got: %s", testCase, testCase.expectedResult, string(data)) |
| 135 | } |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | // mergeConditionKeyMap() is called and the result is validated. |
| 141 | func TestMergeConditionKeyMap(t *testing.T) { |
nothing calls this directly
no test coverage detected