File nodes as a stale index holds them: the link targets were ordinary * directories and files when they were indexed (discovery itself never * follows a link). inner/same.c is deliberately absent so its line can only * be reached through alias/ or mirror.c. */
| 24360 | * follows a link). inner/same.c is deliberately absent so its line can only |
| 24361 | * be reached through alias/ or mirror.c. */ |
| 24362 | static bool search_root_fixture_index(cbm_store_t *store, const char *project) { |
| 24363 | static const char *const files[] = {"main.c", "alias/same.c", "mirror.c", |
| 24364 | "link.c", "lib/deep.c", "lib/sym.c"}; |
| 24365 | for (size_t i = 0; i < sizeof(files) / sizeof(files[0]); i++) { |
| 24366 | const char *base = strrchr(files[i], '/'); |
| 24367 | base = base ? base + 1 : files[i]; |
| 24368 | char qualified_name[CBM_SZ_256]; |
| 24369 | snprintf(qualified_name, sizeof(qualified_name), "%s.%s", project, files[i]); |
| 24370 | cbm_node_t file = {.project = project, |
| 24371 | .label = "File", |
| 24372 | .name = base, |
| 24373 | .qualified_name = qualified_name, |
| 24374 | .file_path = files[i]}; |
| 24375 | if (cbm_store_upsert_node(store, &file) <= 0) { |
| 24376 | return false; |
| 24377 | } |
| 24378 | } |
| 24379 | cbm_node_t inside = {.project = project, |
| 24380 | .label = "Variable", |
| 24381 | .name = "INSIDE_SYMBOL", |
| 24382 | .qualified_name = "search-root.INSIDE_SYMBOL", |
| 24383 | .file_path = "main.c", |
| 24384 | .start_line = 1, |
| 24385 | .end_line = 1}; |
| 24386 | cbm_node_t far_symbol = {.project = project, |
| 24387 | .label = "Variable", |
| 24388 | .name = "FAR_DIR_SYMBOL", |
| 24389 | .qualified_name = "search-root.lib.FAR_DIR_SYMBOL", |
| 24390 | .file_path = "lib/sym.c", |
| 24391 | .start_line = 1, |
| 24392 | .end_line = 1}; |
| 24393 | return cbm_store_upsert_node(store, &inside) > 0 && |
| 24394 | cbm_store_upsert_node(store, &far_symbol) > 0; |
| 24395 | } |
| 24396 | |
| 24397 | typedef struct { |
| 24398 | bool ok; /* a non-error response with text content */ |
no test coverage detected