(t *testing.T)
| 1082 | } |
| 1083 | |
| 1084 | func TestHasLabel(t *testing.T) { |
| 1085 | var testcases = []struct { |
| 1086 | desc string |
| 1087 | labels map[string][]string |
| 1088 | key string |
| 1089 | value string |
| 1090 | wantHasLabel bool |
| 1091 | }{ |
| 1092 | { |
| 1093 | desc: "empty label does not have label", |
| 1094 | labels: map[string][]string{}, |
| 1095 | key: "key", |
| 1096 | value: "value", |
| 1097 | wantHasLabel: false, |
| 1098 | }, |
| 1099 | { |
| 1100 | desc: "label with one key and value has label", |
| 1101 | labels: map[string][]string{"key": {"value"}}, |
| 1102 | key: "key", |
| 1103 | value: "value", |
| 1104 | wantHasLabel: true, |
| 1105 | }, |
| 1106 | { |
| 1107 | desc: "label with one key and value does not have label", |
| 1108 | labels: map[string][]string{"key": {"value"}}, |
| 1109 | key: "key1", |
| 1110 | value: "value1", |
| 1111 | wantHasLabel: false, |
| 1112 | }, |
| 1113 | { |
| 1114 | desc: "label with many keys and values has label", |
| 1115 | labels: map[string][]string{ |
| 1116 | "key1": {"value2", "value1"}, |
| 1117 | "key2": {"value1", "value2", "value2"}, |
| 1118 | "key3": {"value1", "value2", "value2"}, |
| 1119 | }, |
| 1120 | key: "key1", |
| 1121 | value: "value1", |
| 1122 | wantHasLabel: true, |
| 1123 | }, |
| 1124 | { |
| 1125 | desc: "label with many keys and values does not have label", |
| 1126 | labels: map[string][]string{ |
| 1127 | "key1": {"value2", "value1"}, |
| 1128 | "key2": {"value1", "value2", "value2"}, |
| 1129 | "key3": {"value1", "value2", "value2"}, |
| 1130 | }, |
| 1131 | key: "key5", |
| 1132 | value: "value5", |
| 1133 | wantHasLabel: false, |
| 1134 | }, |
| 1135 | } |
| 1136 | |
| 1137 | for _, tc := range testcases { |
| 1138 | t.Run(tc.desc, func(t *testing.T) { |
| 1139 | sample := &Sample{ |
| 1140 | Label: tc.labels, |
| 1141 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…