(t *testing.T)
| 180 | } |
| 181 | |
| 182 | func TestDecodeSkipLabels(t *testing.T) { |
| 183 | cases := []struct { |
| 184 | in []byte |
| 185 | skipCacheIn string |
| 186 | labels []config.Label |
| 187 | out []string |
| 188 | err bool |
| 189 | }{ |
| 190 | { |
| 191 | in: append([]byte{0x8, 0x0, 0x0, 0x0}, zeroPaddedString("bananas", 32)...), |
| 192 | skipCacheIn: "", |
| 193 | labels: []config.Label{ |
| 194 | { |
| 195 | Name: "number", |
| 196 | Size: 4, |
| 197 | Decoders: []config.Decoder{ |
| 198 | { |
| 199 | Name: "uint", |
| 200 | }, |
| 201 | }, |
| 202 | }, |
| 203 | { |
| 204 | Name: "fruit", |
| 205 | Size: 32, |
| 206 | Decoders: []config.Decoder{ |
| 207 | { |
| 208 | Name: "string", |
| 209 | }, |
| 210 | { |
| 211 | Name: "regexp", |
| 212 | Regexps: []string{ |
| 213 | "^bananas$", |
| 214 | "$is-banana-even-fruit$", |
| 215 | }, |
| 216 | }, |
| 217 | }, |
| 218 | }, |
| 219 | }, |
| 220 | out: []string{"8", "bananas"}, |
| 221 | err: false, |
| 222 | }, |
| 223 | { |
| 224 | in: append([]byte{0x8, 0x0, 0x0, 0x0}, zeroPaddedString("bananas", 32)...), |
| 225 | skipCacheIn: string(zeroPaddedString("bananas", 32)), |
| 226 | labels: []config.Label{ |
| 227 | { |
| 228 | Name: "number", |
| 229 | Size: 4, |
| 230 | Decoders: []config.Decoder{ |
| 231 | { |
| 232 | Name: "uint", |
| 233 | }, |
| 234 | }, |
| 235 | }, |
| 236 | { |
| 237 | Name: "fruit", |
| 238 | Size: 32, |
| 239 | Decoders: []config.Decoder{ |
nothing calls this directly
no test coverage detected