Policies consume the exact query-local snapshot and classify paths before * target applicability is known. */
| 2384 | /* Policies consume the exact query-local snapshot and classify paths before |
| 2385 | * target applicability is known. */ |
| 2386 | static cbm_test_policy_t *policy_of(const char *body) { |
| 2387 | char dir[512], path[600]; |
| 2388 | snprintf(dir, sizeof(dir), "%s/cbm-impact-policy-XXXXXX", cbm_tmpdir()); |
| 2389 | if (!cbm_mkdtemp(dir)) |
| 2390 | return NULL; |
| 2391 | snprintf(path, sizeof(path), "%s/config.json", dir); |
| 2392 | cbm_test_policy_t *policy = NULL; |
| 2393 | if (th_write_file(path, body) == 0) { |
| 2394 | cbm_test_config_t *config = cbm_test_config_load(path, false); |
| 2395 | if (config) |
| 2396 | policy = cbm_test_policy_new(config); |
| 2397 | cbm_test_config_free(config); |
| 2398 | } |
| 2399 | th_rmtree(dir); |
| 2400 | return policy; |
| 2401 | } |
| 2402 | |
| 2403 | static bool policy_matches(const cbm_test_policy_t *policy, const char *path, const char *id) { |
| 2404 | const cbm_test_rule_t *rule = NULL; |
no test coverage detected