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. */
| 8173 | * name is `internal` (which may differ from the filename), holding one |
| 8174 | * Function node named `fn`. Returns true on success. */ |
| 8175 | static bool issue704_make_db(const char *dir, const char *filename, const char *internal, |
| 8176 | const char *fn) { |
| 8177 | char path[700]; |
| 8178 | snprintf(path, sizeof(path), "%s/%s", dir, filename); |
| 8179 | cbm_store_t *st = cbm_store_open_path(path); |
| 8180 | if (!st) { |
| 8181 | return false; |
| 8182 | } |
| 8183 | bool ok = (cbm_store_upsert_project(st, internal, dir) == CBM_STORE_OK); |
| 8184 | if (ok) { |
| 8185 | char qn[256]; |
| 8186 | snprintf(qn, sizeof(qn), "%s.%s", internal, fn); |
| 8187 | cbm_node_t n = {0}; |
| 8188 | n.project = internal; |
| 8189 | n.label = "Function"; |
| 8190 | n.name = fn; |
| 8191 | n.qualified_name = qn; |
| 8192 | n.file_path = "main.go"; |
| 8193 | n.start_line = 1; |
| 8194 | n.end_line = 2; |
| 8195 | ok = (cbm_store_upsert_node(st, &n) > 0); |
| 8196 | } |
| 8197 | cbm_store_close(st); |
| 8198 | return ok; |
| 8199 | } |
| 8200 | |
| 8201 | TEST(tool_resolve_store_by_internal_name_issue704) { |
| 8202 | char cache[256]; |
no test coverage detected