(t *testing.T)
| 282 | } |
| 283 | |
| 284 | func TestSpansetOperationEvaluate(t *testing.T) { |
| 285 | testCases := []evalTC{ |
| 286 | { |
| 287 | "{ .foo = `a` } && { .foo = `b` }", |
| 288 | []*Spanset{ |
| 289 | {Spans: []Span{ |
| 290 | // This spanset will be kept because it satisfies both conditions |
| 291 | &mockSpan{id: []byte{1}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticString("a")}}, |
| 292 | &mockSpan{id: []byte{2}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticString("b")}}, |
| 293 | }}, |
| 294 | {Spans: []Span{ |
| 295 | // This spanset will be dropped |
| 296 | &mockSpan{id: []byte{3}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticString("b")}}, |
| 297 | }}, |
| 298 | }, |
| 299 | []*Spanset{ |
| 300 | {Spans: []Span{ |
| 301 | &mockSpan{id: []byte{2}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticString("b")}}, |
| 302 | &mockSpan{id: []byte{1}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticString("a")}}, |
| 303 | }}, |
| 304 | }, |
| 305 | }, |
| 306 | { |
| 307 | "{ .foo = `a` } || { .foo = `b` }", |
| 308 | []*Spanset{ |
| 309 | {Spans: []Span{ |
| 310 | &mockSpan{id: []byte{1}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticString("a")}}, |
| 311 | &mockSpan{id: []byte{2}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticString("b")}}, |
| 312 | }}, |
| 313 | {Spans: []Span{ |
| 314 | // Second span will be dropped |
| 315 | &mockSpan{id: []byte{3}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticString("b")}}, |
| 316 | &mockSpan{id: []byte{4}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticString("c")}}, |
| 317 | }}, |
| 318 | }, |
| 319 | []*Spanset{ |
| 320 | {Spans: []Span{ |
| 321 | &mockSpan{id: []byte{2}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticString("b")}}, |
| 322 | &mockSpan{id: []byte{1}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticString("a")}}, |
| 323 | }}, |
| 324 | {Spans: []Span{ |
| 325 | &mockSpan{id: []byte{3}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticString("b")}}, |
| 326 | }}, |
| 327 | }, |
| 328 | }, |
| 329 | { |
| 330 | "{ true } && { true } && { true }", |
| 331 | []*Spanset{ |
| 332 | {Spans: []Span{ |
| 333 | &mockSpan{id: []byte{1}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticString("a")}}, |
| 334 | }}, |
| 335 | }, |
| 336 | []*Spanset{ |
| 337 | {Spans: []Span{ |
| 338 | &mockSpan{id: []byte{1}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticString("a")}}, |
| 339 | }}, |
| 340 | }, |
| 341 | }, |
nothing calls this directly
no test coverage detected