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. */
| 8080 | * name is `internal` (which may differ from the filename), holding one |
| 8081 | * Function node named `fn`. Returns true on success. */ |
| 8082 | static bool issue704_make_db(const char *dir, const char *filename, const char *internal, |
| 8083 | const char *fn) { |
| 8084 | char path[700]; |
| 8085 | snprintf(path, sizeof(path), "%s/%s", dir, filename); |
| 8086 | cbm_store_t *st = cbm_store_open_path(path); |
| 8087 | if (!st) { |
| 8088 | return false; |
| 8089 | } |
| 8090 | bool ok = (cbm_store_upsert_project(st, internal, dir) == CBM_STORE_OK); |
| 8091 | if (ok) { |
| 8092 | char qn[256]; |
| 8093 | snprintf(qn, sizeof(qn), "%s.%s", internal, fn); |
| 8094 | cbm_node_t n = {0}; |
| 8095 | n.project = internal; |
| 8096 | n.label = "Function"; |
| 8097 | n.name = fn; |
| 8098 | n.qualified_name = qn; |
| 8099 | n.file_path = "main.go"; |
| 8100 | n.start_line = 1; |
| 8101 | n.end_line = 2; |
| 8102 | ok = (cbm_store_upsert_node(st, &n) > 0); |
| 8103 | } |
| 8104 | cbm_store_close(st); |
| 8105 | return ok; |
| 8106 | } |
| 8107 | |
| 8108 | TEST(tool_resolve_store_by_internal_name_issue704) { |
| 8109 | char cache[256]; |
no test coverage detected