From: Rusty Russell <rusty@rustcorp.com.au>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: ccan <ccan@lists.ozlabs.org>
Subject: Re: [PATCH] ccanlint: enhance and streamline "output" testing lines.
Date: Tue, 29 Sep 2015 07:18:41 +0930 [thread overview]
Message-ID: <8737xyp64m.fsf@rustcorp.com.au> (raw)
In-Reply-To: <20150928145832.GO11620@voom.redhat.com>
David Gibson <david@gibson.dropbear.id.au> 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
ccan@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/ccan
prev parent reply other threads:[~2015-09-28 23:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-28 3:18 [PATCH] ccanlint: enhance and streamline "output" testing lines Rusty Russell
2015-09-28 14:32 ` David Gibson
2015-09-28 14:58 ` David Gibson
2015-09-28 21:48 ` Rusty Russell [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8737xyp64m.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=ccan@lists.ozlabs.org \
--cc=david@gibson.dropbear.id.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.