The doc -> code candidate fixture: six Go config families, a test whose * comment is the section's own text, and a README with a Mail-configuration * section and a Changelog section. */
| 22071 | * comment is the section's own text, and a README with a Mail-configuration |
| 22072 | * section and a Changelog section. */ |
| 22073 | static void write_doc_candidate_fixture(const char *tmp) { |
| 22074 | static const char *const subjects[] = {"User", "Server", "Client", "Cache", "Queue", "Mail"}; |
| 22075 | for (size_t i = 0; i < sizeof(subjects) / sizeof(subjects[0]); i++) { |
| 22076 | char file[64]; |
| 22077 | snprintf(file, sizeof(file), "%s_config.go", subjects[i]); |
| 22078 | write_sem_family(tmp, file, subjects[i]); |
| 22079 | } |
| 22080 | /* A test whose comment is the section's own text: the best match of all, |
| 22081 | * and still never a candidate. */ |
| 22082 | write_temp_file(tmp, "mail_config_test.go", |
| 22083 | "package main\n\n" |
| 22084 | "// TestParseMailConfig: the mail config file is parsed by ParseMailConfig,\n" |
| 22085 | "// which loads the mail config from disk and validates the mail config\n" |
| 22086 | "// fields before anything reads them. Missing fields fail the validation,\n" |
| 22087 | "// and the parsed mail config can be written back to disk afterwards.\n" |
| 22088 | "func TestParseMailConfig(t *testing.T) {\n" |
| 22089 | "\tParseMailConfig(\"mail.conf\")\n}\n"); |
| 22090 | write_temp_file(tmp, "README.md", |
| 22091 | "# Mail configuration\n\n" |
| 22092 | "The mail config file is parsed by ParseMailConfig, which loads the mail " |
| 22093 | "config from disk and validates the mail config fields before anything " |
| 22094 | "reads them. Missing fields fail the validation, and the parsed mail " |
| 22095 | "config can be written back to disk afterwards.\n\n" |
| 22096 | "## Changelog\n\n" |
| 22097 | "The mail config loader now validates missing fields and writes the mail " |
| 22098 | "config back to disk after parsing, so a parsed mail config file always " |
| 22099 | "carries every field it needs.\n"); |
| 22100 | } |
| 22101 | |
| 22102 | /* Doc -> code candidates end to end: a full index publishes a section's |
| 22103 | * calibrated candidates (the best match first, a test function never, a |
no test coverage detected