(t *testing.T)
| 507 | } |
| 508 | |
| 509 | func TestGroupCoalesceOperation(t *testing.T) { |
| 510 | tests := []struct { |
| 511 | in string |
| 512 | expected Pipeline |
| 513 | expectedStr string |
| 514 | }{ |
| 515 | {in: "by(.a) | coalesce()", expected: newPipeline(newGroupOperation(NewAttribute("a")), newCoalesceOperation()), expectedStr: "by(.a)|coalesce()"}, |
| 516 | {in: "by(.a + .b)", expected: newPipeline(newGroupOperation(newBinaryOperation(OpAdd, NewAttribute("a"), NewAttribute("b")))), expectedStr: "by(.a + .b)"}, |
| 517 | } |
| 518 | |
| 519 | for _, tc := range tests { |
| 520 | t.Run(tc.in, func(t *testing.T) { |
| 521 | actual, err := Parse(tc.in) |
| 522 | |
| 523 | require.NoError(t, err) |
| 524 | require.Equal(t, newRootExpr(tc.expected), actual) |
| 525 | require.Equal(t, tc.expectedStr, actual.String()) |
| 526 | }) |
| 527 | } |
| 528 | } |
| 529 | |
| 530 | func TestSelectErrors(t *testing.T) { |
| 531 | tests := []struct { |
nothing calls this directly
no test coverage detected