MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / doc_props_contain

Function doc_props_contain

tests/test_pipeline.c:15823–15857  ·  view source on GitHub ↗

Index one file; true when the node with this label and name stores `want` in * its properties JSON. */

Source from the content-addressed store, hash-verified

15821/* Index one file; true when the node with this label and name stores `want` in
15822 * its properties JSON. */
15823static bool doc_props_contain(const char *file, const char *content, const char *label,
15824 const char *name, const char *want) {
15825 const char *files[] = {file};
15826 const char *contents[] = {content};
15827 if (setup_lang_repo(files, contents, 1) != 0) {
15828 return false;
15829 }
15830 char db[512];
15831 snprintf(db, sizeof(db), "%s/test.db", g_lang_tmpdir);
15832 cbm_pipeline_t *p = cbm_pipeline_new(g_lang_tmpdir, db, CBM_MODE_FULL);
15833 bool found = false;
15834 if (p && cbm_pipeline_run(p) == 0) {
15835 cbm_store_t *s = cbm_store_open_path(db);
15836 cbm_node_t *nodes = NULL;
15837 int nc = 0;
15838 if (s && cbm_store_find_nodes_by_label(s, cbm_pipeline_project_name(p), label, &nodes,
15839 &nc) == 0) {
15840 for (int i = 0; i < nc; i++) {
15841 if (nodes[i].name && strcmp(nodes[i].name, name) == 0 && nodes[i].properties_json &&
15842 strstr(nodes[i].properties_json, want)) {
15843 found = true;
15844 }
15845 }
15846 cbm_store_free_nodes(nodes, nc);
15847 }
15848 if (s) {
15849 cbm_store_close(s);
15850 }
15851 }
15852 if (p) {
15853 cbm_pipeline_free(p);
15854 }
15855 teardown_lang_repo();
15856 return found;
15857}
15858
15859TEST(pipeline_doc_go_package_comment_on_file_node) {
15860 /* go/doc: the comment group touching `package` documents the package; it is

Callers 1

test_pipeline.cFile · 0.85

Calls 10

setup_lang_repoFunction · 0.85
cbm_pipeline_newFunction · 0.85
cbm_pipeline_runFunction · 0.85
cbm_store_open_pathFunction · 0.85
cbm_store_free_nodesFunction · 0.85
cbm_store_closeFunction · 0.85
cbm_pipeline_freeFunction · 0.85
teardown_lang_repoFunction · 0.85

Tested by

no test coverage detected