| 1160 | } |
| 1161 | |
| 1162 | void check_example_14(char *source) { |
| 1163 | struct list_head *tokens; |
| 1164 | struct graphql_token *tok; |
| 1165 | |
| 1166 | if (!mute) printf("// Example No. 14\n"); |
| 1167 | |
| 1168 | sprintf(source, "\ |
| 1169 | {\n\ |
| 1170 | user(id: 4) {\n\ |
| 1171 | id\n\ |
| 1172 | name\n\ |
| 1173 | smallPic: profilePic(size: 64)\n\ |
| 1174 | bigPic: profilePic(size: 1024)\n\ |
| 1175 | }\n\ |
| 1176 | }\n\ |
| 1177 | "); |
| 1178 | |
| 1179 | // Test the lexer. |
| 1180 | TEST_CONT(graphql_lex(NULL, source, &tokens) == NULL); |
| 1181 | TEST_ABRT(listlen(tokens) == 28); |
| 1182 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == '{'); |
| 1183 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == 'a'); |
| 1184 | TEST_STRG(tok->token_string, "user"); |
| 1185 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == '('); |
| 1186 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == 'a'); |
| 1187 | TEST_STRG(tok->token_string, "id"); |
| 1188 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == ':'); |
| 1189 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == 'i'); |
| 1190 | TEST_STRG(tok->token_string, "4"); |
| 1191 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == ')'); |
| 1192 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == '{'); |
| 1193 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == 'a'); |
| 1194 | TEST_STRG(tok->token_string, "id"); |
| 1195 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == 'a'); |
| 1196 | TEST_STRG(tok->token_string, "name"); |
| 1197 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == 'a'); |
| 1198 | TEST_STRG(tok->token_string, "smallPic"); |
| 1199 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == ':'); |
| 1200 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == 'a'); |
| 1201 | TEST_STRG(tok->token_string, "profilePic"); |
| 1202 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == '('); |
| 1203 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == 'a'); |
| 1204 | TEST_STRG(tok->token_string, "size"); |
| 1205 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == ':'); |
| 1206 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == 'i'); |
| 1207 | TEST_STRG(tok->token_string, "64"); |
| 1208 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == ')'); |
| 1209 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == 'a'); |
| 1210 | TEST_STRG(tok->token_string, "bigPic"); |
| 1211 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == ':'); |
| 1212 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == 'a'); |
| 1213 | TEST_STRG(tok->token_string, "profilePic"); |
| 1214 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == '('); |
| 1215 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == 'a'); |
| 1216 | TEST_STRG(tok->token_string, "size"); |
| 1217 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == ':'); |
| 1218 | tok = list_pop(tokens, struct graphql_token, node); TEST_CONT(tok->token_type == 'i'); |
| 1219 | TEST_STRG(tok->token_string, "1024"); |
nothing calls this directly
no test coverage detected