This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Share the "multi_line" helper among all Ada testcases
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Pierre-Marie de Rodat <derodat at adacore dot com>, GDB Patches <gdb-patches at sourceware dot org>
- Date: Wed, 18 Mar 2015 10:12:38 -0400
- Subject: Re: [PATCH] Share the "multi_line" helper among all Ada testcases
- Authentication-results: sourceware.org; auth=none
- References: <54FEDB92 dot 9060808 at adacore dot com> <20150317200809 dot GD7494 at adacore dot com> <5509492C dot 5000604 at redhat dot com>
> Meanwhile, we grew many tests that do [join [list ... "\r\n"]],
> like this:
>
> # start by listing all functions
> gdb_test "record function-call-history /ci 1, +20" [join [list \
> "1\tmain\tinst 1,1" \
> "2\t fun4\tinst 2,4" \
> "3\t fun1\tinst 5,8" \
> "4\t fun4\tinst 9,9" \
> "5\t fun2\tinst 10,12" \
> "6\t fun1\tinst 13,16" \
> "7\t fun2\tinst 17,18" \
> "8\t fun4\tinst 19,19" \
> "9\t fun3\tinst 20,22" \
> "10\t fun1\tinst 23,26" \
> "11\t fun3\tinst 27,27" \
> "12\t fun2\tinst 28,30" \
> "13\t fun1\tinst 31,34" \
> "14\t fun2\tinst 35,36" \
> "15\t fun3\tinst 37,38" \
> "16\t fun4\tinst 39,40" \
> ] "\r\n"]
>
> Your multi_line looks like almost the same, except that it's
> a tiny bit more lax:
>
> proc multi_line { args } {
> return [join $args "\[\r\n\]*"]
> }
>
> That will accept _no_ newline between list elements, and
> multiple newlines too. How about making multi_line join
> with strict "\r\n" too? Then if you need to match one
> empty line, you can do:
>
> [multi_line "line1" \
> ""
> "line3"]
>
> and if you need multiple, you can always do:
>
> [multi_line "line1" \
> "\[\r\n\]*"
> "lineNN"]
Very good suggestion, I like it! Pierre-Marie?
--
Joel