Index one file; true when the node with this label and name stores `want` in * its properties JSON. */
| 15821 | /* Index one file; true when the node with this label and name stores `want` in |
| 15822 | * its properties JSON. */ |
| 15823 | static 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 | |
| 15859 | TEST(pipeline_doc_go_package_comment_on_file_node) { |
| 15860 | /* go/doc: the comment group touching `package` documents the package; it is |
no test coverage detected