Scan one file and scope what it left uncertain. The uncertainty of a file * that defines its own suite stays with those suites, which then run whole; * a file that registers runner suites or defines no suite has nothing to * scope it to, and a failure is never scoped. */
| 1265 | * a file that registers runner suites or defines no suite has nothing to |
| 1266 | * scope it to, and a failure is never scoped. */ |
| 1267 | static bool tm_add_source(cbm_test_model_t *m, const char *file, const char *text, size_t len, |
| 1268 | int language_kind) { |
| 1269 | if (!m || m->finished || !file || (!text && len > 0)) { |
| 1270 | if (m) { |
| 1271 | m->incomplete = true; |
| 1272 | } |
| 1273 | return false; |
| 1274 | } |
| 1275 | bool before = m->incomplete; |
| 1276 | int first_suite = m->suite_count; |
| 1277 | int first_runner = m->runner_count; |
| 1278 | m->incomplete = false; |
| 1279 | bool ok = tm_scan_source(m, file, text, len, language_kind); |
| 1280 | bool uncertain = m->incomplete; |
| 1281 | m->incomplete = before; |
| 1282 | if (!ok) { |
| 1283 | m->incomplete = true; |
| 1284 | return false; |
| 1285 | } |
| 1286 | if (uncertain) { |
| 1287 | bool own_suite = m->suite_count > first_suite; |
| 1288 | bool registers_runner = m->runner_count > first_runner; |
| 1289 | if (!own_suite || registers_runner) { |
| 1290 | m->incomplete = true; |
| 1291 | } else { |
| 1292 | for (int i = first_suite; i < m->suite_count; i++) { |
| 1293 | m->suites[i].uncertain = true; |
| 1294 | } |
| 1295 | m->scoped_uncertain = true; |
| 1296 | } |
| 1297 | } |
| 1298 | return true; |
| 1299 | } |
| 1300 | |
| 1301 | bool cbm_test_model_add_source(cbm_test_model_t *m, const char *file, const char *text, |
| 1302 | size_t len) { |
no test coverage detected