| 112 | } gic_semantic; |
| 113 | |
| 114 | static bool gic_semantic_one(const gic_semantic *row) { |
| 115 | /* Legacy controls run first, so a broken fixture is not a feature failure. */ |
| 116 | cbm_gitignore_t *legacy = cbm_gitignore_parse(row->patterns); |
| 117 | if (!legacy) |
| 118 | return false; |
| 119 | int old = cbm_gitignore_match_result(legacy, row->path, row->directory); |
| 120 | bool old_bool = cbm_gitignore_matches(legacy, row->path, row->directory); |
| 121 | cbm_gitignore_free(legacy); |
| 122 | if (old != (int)row->expected || old_bool != (row->expected == CBM_IGNORE_IGNORED)) |
| 123 | return false; |
| 124 | cbm_ignore_checked_t *owner = NULL; |
| 125 | cbm_ignore_checked_limits_t limits = gic_limits(); |
| 126 | const cbm_ignore_program_t *program = NULL; |
| 127 | bool ok = gic_open(&owner, &limits) && |
| 128 | gic_parse(owner, row->patterns, strlen(row->patterns), row->count, &program) && |
| 129 | gic_match(owner, program, row->path, row->directory, row->expected); |
| 130 | cbm_ignore_checked_free(owner); |
| 131 | return ok; |
| 132 | } |
| 133 | |
| 134 | TEST(gic_a_semantics_and_legacy_parity) { |
| 135 | const gic_semantic rows[] = { |
no test coverage detected