(t *testing.T)
| 924 | } |
| 925 | |
| 926 | func TestConstantFoldingNormalizeIDs(t *testing.T) { |
| 927 | tests := []struct { |
| 928 | expr string |
| 929 | ids []int64 |
| 930 | macros map[int64]string |
| 931 | normalizedIDs []int64 |
| 932 | normalizedMacros map[int64]string |
| 933 | }{ |
| 934 | { |
| 935 | expr: `[1, 2, 3]`, |
| 936 | ids: []int64{1, 2, 3, 4}, |
| 937 | normalizedIDs: []int64{1, 2, 3, 4}, |
| 938 | }, |
| 939 | { |
| 940 | expr: `google.expr.proto3.test.TestAllTypes{single_int32: 0}`, |
| 941 | ids: []int64{1, 2, 3}, |
| 942 | normalizedIDs: []int64{1, 2, 3}, |
| 943 | }, |
| 944 | { |
| 945 | expr: `has({x: 'value'}.single_int32)`, |
| 946 | ids: []int64{2, 3, 4, 5, 7}, |
| 947 | macros: map[int64]string{7: ` |
| 948 | call_expr: { |
| 949 | function: "has" |
| 950 | args: { |
| 951 | id: 6 |
| 952 | select_expr: { |
| 953 | operand: { |
| 954 | id: 2 |
| 955 | struct_expr: { |
| 956 | entries: { |
| 957 | id: 3 |
| 958 | map_key: { |
| 959 | id: 4 |
| 960 | ident_expr: { |
| 961 | name: "x" |
| 962 | } |
| 963 | } |
| 964 | value: { |
| 965 | id: 5 |
| 966 | const_expr: { |
| 967 | string_value: "value" |
| 968 | } |
| 969 | } |
| 970 | } |
| 971 | } |
| 972 | } |
| 973 | field: "single_int32" |
| 974 | } |
| 975 | } |
| 976 | }`}, |
| 977 | normalizedIDs: []int64{1, 2, 3, 4, 5}, |
| 978 | normalizedMacros: map[int64]string{1: ` |
| 979 | call_expr: { |
| 980 | function: "has" |
| 981 | args: { |
| 982 | id: 6 |
| 983 | select_expr: { |
nothing calls this directly
no test coverage detected