Re: [PATCH] ccanlint: enhance and streamline "output" testing lines.
Rusty Russell <[email protected]> Tue, 29 Sep 2015 07:18:41 +0930
| Newsgroups | org.ozlabs.lists.ccan |
|---|---|
| Message-ID | <[email protected]> |
David Gibson <[email protected]> writes: > On Tue, Sep 29, 2015 at 12:32:36AM +1000, David Gibson wrote: >> On Mon, Sep 28, 2015 at 12:48:03PM +0930, Paul 'Rusty' Russell wrote: >> > 1) Require "" around input >> > 2) Make them optional around output: if not there, loose match whitespace >> > 3) Handle \n in output. >> > 4) Document that "Given xxx" is optional. >> >> Patch looks fine to me. > > I take that back. With a bit more playing, noticed that if you > *don't* put" around the input, it will silently skip the example > expected output test. It should detect some malformed uses. Let's beef it up, so it errors on any comment not otherwise recognized which starts with "// given" or "// outputs". (It already caught the "given" case). diff --git a/tools/ccanlint/tests/examples_run.c b/tools/ccanlint/tests/examples_run.c index c7d04c2..258e290 100644 --- a/tools/ccanlint/tests/examples_run.c +++ b/tools/ccanlint/tests/examples_run.c @@ -125,8 +125,8 @@ static char *find_expect(struct ccan_file *file, return expect; } - /* "Given" without "output"? */ - if (*input) { + /* Other malformed line? */ + if (!strncasecmp(p, "given") || !strncasecmp(p, "outputs")) { *error = true; return p; } Cheers, Rusty. _______________________________________________ ccan mailing list [email protected] https://lists.ozlabs.org/listinfo/ccan