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. */
| 17013 | * name is `internal` (which may differ from the filename), holding one |
| 17014 | * Function node named `fn`. Returns true on success. */ |
| 17015 | static bool issue704_make_db(const char *dir, const char *filename, const char *internal, |
| 17016 | const char *fn) { |
| 17017 | char path[700]; |
| 17018 | snprintf(path, sizeof(path), "%s/%s", dir, filename); |
| 17019 | cbm_store_t *st = cbm_store_open_path(path); |
| 17020 | if (!st) { |
| 17021 | return false; |
| 17022 | } |
| 17023 | bool ok = (cbm_store_upsert_project(st, internal, dir) == CBM_STORE_OK); |
| 17024 | if (ok) { |
| 17025 | char qn[256]; |
| 17026 | snprintf(qn, sizeof(qn), "%s.%s", internal, fn); |
| 17027 | cbm_node_t n = {0}; |
| 17028 | n.project = internal; |
| 17029 | n.label = "Function"; |
| 17030 | n.name = fn; |
| 17031 | n.qualified_name = qn; |
| 17032 | n.file_path = "main.go"; |
| 17033 | n.start_line = 1; |
| 17034 | n.end_line = 2; |
| 17035 | ok = (cbm_store_upsert_node(st, &n) > 0); |
| 17036 | } |
| 17037 | cbm_store_close(st); |
| 17038 | return ok; |
| 17039 | } |
| 17040 | |
| 17041 | TEST(tool_resolve_store_by_internal_name_issue704) { |
| 17042 | char cache[256]; |
no test coverage detected