(t *testing.T)
| 599 | } |
| 600 | |
| 601 | func TestConstantFoldingNormalizeIDs(t *testing.T) { |
| 602 | tests := []struct { |
| 603 | expr string |
| 604 | ids []int64 |
| 605 | macros map[int64]string |
| 606 | normalizedIDs []int64 |
| 607 | normalizedMacros map[int64]string |
| 608 | }{ |
| 609 | { |
| 610 | expr: `[1, 2, 3]`, |
| 611 | ids: []int64{1, 2, 3, 4}, |
| 612 | normalizedIDs: []int64{1, 2, 3, 4}, |
| 613 | }, |
| 614 | { |
| 615 | expr: `google.expr.proto3.test.TestAllTypes{single_int32: 0}`, |
| 616 | ids: []int64{1, 2, 3}, |
| 617 | normalizedIDs: []int64{1, 2, 3}, |
| 618 | }, |
| 619 | { |
| 620 | expr: `has({x: 'value'}.single_int32)`, |
| 621 | ids: []int64{2, 3, 4, 5, 7}, |
| 622 | macros: map[int64]string{7: ` |
| 623 | call_expr: { |
| 624 | function: "has" |
| 625 | args: { |
| 626 | id: 6 |
| 627 | select_expr: { |
| 628 | operand: { |
| 629 | id: 2 |
| 630 | struct_expr: { |
| 631 | entries: { |
| 632 | id: 3 |
| 633 | map_key: { |
| 634 | id: 4 |
| 635 | ident_expr: { |
| 636 | name: "x" |
| 637 | } |
| 638 | } |
| 639 | value: { |
| 640 | id: 5 |
| 641 | const_expr: { |
| 642 | string_value: "value" |
| 643 | } |
| 644 | } |
| 645 | } |
| 646 | } |
| 647 | } |
| 648 | field: "single_int32" |
| 649 | } |
| 650 | } |
| 651 | }`}, |
| 652 | normalizedIDs: []int64{1, 2, 3, 4, 5}, |
| 653 | normalizedMacros: map[int64]string{1: ` |
| 654 | call_expr: { |
| 655 | function: "has" |
| 656 | args: { |
| 657 | id: 6 |
| 658 | select_expr: { |
nothing calls this directly
no test coverage detected