Create a file-backed project db at / whose INTERNAL project * name is `internal` (which may differ from the filename), holding one * Function node named `fn`. Returns true on success. */
| 20436 | * name is `internal` (which may differ from the filename), holding one |
| 20437 | * Function node named `fn`. Returns true on success. */ |
| 20438 | static bool issue704_make_db(const char *dir, const char *filename, const char *internal, |
| 20439 | const char *fn) { |
| 20440 | char path[700]; |
| 20441 | snprintf(path, sizeof(path), "%s/%s", dir, filename); |
| 20442 | cbm_store_t *st = cbm_store_open_path(path); |
| 20443 | if (!st) { |
| 20444 | return false; |
| 20445 | } |
| 20446 | bool ok = (cbm_store_upsert_project(st, internal, dir) == CBM_STORE_OK); |
| 20447 | if (ok) { |
| 20448 | char qn[256]; |
| 20449 | snprintf(qn, sizeof(qn), "%s.%s", internal, fn); |
| 20450 | cbm_node_t n = {0}; |
| 20451 | n.project = internal; |
| 20452 | n.label = "Function"; |
| 20453 | n.name = fn; |
| 20454 | n.qualified_name = qn; |
| 20455 | n.file_path = "main.go"; |
| 20456 | n.start_line = 1; |
| 20457 | n.end_line = 2; |
| 20458 | ok = (cbm_store_upsert_node(st, &n) > 0); |
| 20459 | } |
| 20460 | cbm_store_close(st); |
| 20461 | return ok; |
| 20462 | } |
| 20463 | |
| 20464 | /* Cache entry classification must use exact internal names. CI workspace |
| 20465 | * paths can produce real project names beginning with one or more underscores. */ |
no test coverage detected