summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2014-11-10 15:00:06 +1030
committerRusty Russell <rusty@rustcorp.com.au>2014-11-10 15:00:06 +1030
commitc5a49e4942e98f17744f2a50dead077b34d0ceaf (patch)
treec65ade78e0acda5665f5829f2e5bdf8d3a6773ab
parent49bb40e9615ada5a3e0d06bc45613744f441895c (diff)
ccanlint: check all headers for examples.
pushpull module doesn't have examples in pushpull.h. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r--tools/ccanlint/tests/examples_exist.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/tools/ccanlint/tests/examples_exist.c b/tools/ccanlint/tests/examples_exist.c
index e308be20..c42a2e4e 100644
--- a/tools/ccanlint/tests/examples_exist.c
+++ b/tools/ccanlint/tests/examples_exist.c
@@ -79,13 +79,12 @@ static void extract_examples(struct manifest *m,
}
}
- /* Check main header. */
+ /* Check all headers for examples. */
list_for_each(&m->h_files, f, list) {
- if (!strstarts(f->name, m->basename)
- || strlen(f->name) != strlen(m->basename) + 2)
- continue;
+ if (strstarts(f->name, m->basename)
+ && strlen(f->name) == strlen(m->basename) + 2)
+ mainh = f;
- mainh = f;
list_for_each(get_ccan_file_docs(f), d, list) {
if (streq(d->type, "example")) {
score->error = add_example(m, f, d);
@@ -115,7 +114,7 @@ struct ccanlint examples_exist = {
.key = "examples_exist",
.name = "_info and main header file have Example: sections",
.check = extract_examples,
- .needs = "info_exists"
+ .needs = "info_exists main_header_exists"
};
REGISTER_TEST(examples_exist);