(t *testing.T)
| 1060 | } |
| 1061 | |
| 1062 | func TestResolveFieldPath(t *testing.T) { |
| 1063 | for _, spec := range []struct { |
| 1064 | src string |
| 1065 | path string |
| 1066 | wantErr bool |
| 1067 | }{ |
| 1068 | { |
| 1069 | src: ` |
| 1070 | name: 'example.proto' |
| 1071 | package: 'example' |
| 1072 | message_type < |
| 1073 | name: 'ExampleMessage' |
| 1074 | field < |
| 1075 | name: 'string' |
| 1076 | type: TYPE_STRING |
| 1077 | label: LABEL_OPTIONAL |
| 1078 | number: 1 |
| 1079 | > |
| 1080 | > |
| 1081 | `, |
| 1082 | path: "string", |
| 1083 | wantErr: false, |
| 1084 | }, |
| 1085 | // no such field |
| 1086 | { |
| 1087 | src: ` |
| 1088 | name: 'example.proto' |
| 1089 | package: 'example' |
| 1090 | message_type < |
| 1091 | name: 'ExampleMessage' |
| 1092 | field < |
| 1093 | name: 'string' |
| 1094 | type: TYPE_STRING |
| 1095 | label: LABEL_OPTIONAL |
| 1096 | number: 1 |
| 1097 | > |
| 1098 | > |
| 1099 | `, |
| 1100 | path: "something_else", |
| 1101 | wantErr: true, |
| 1102 | }, |
| 1103 | // repeated field |
| 1104 | { |
| 1105 | src: ` |
| 1106 | name: 'example.proto' |
| 1107 | package: 'example' |
| 1108 | message_type < |
| 1109 | name: 'ExampleMessage' |
| 1110 | field < |
| 1111 | name: 'string' |
| 1112 | type: TYPE_STRING |
| 1113 | label: LABEL_REPEATED |
| 1114 | number: 1 |
| 1115 | > |
| 1116 | > |
| 1117 | `, |
| 1118 | path: "string", |
| 1119 | wantErr: false, |
nothing calls this directly
no test coverage detected