Re: [PATCH 1/3] Test of breakpoint output for dprintf

Joel Brobecker
2013-01-10T05:43:56Z

> Yao> +gdb_test "info breakpoints" "3\[\t \]+dprintf .*
> Yao> +\[\t \]+printf \"At foo entry\\\\n\".
> Yao> +\[\t \]+continue.
> Yao> +4\[\t \]+dprintf .*
> Yao> +\[\t \]+printf \"arg=%d, g=%d\\\\n\", arg, g.
> Yao> +\[\t \]+continue." "dprintf info 1"
>
> I find this style of test pretty hard to read.
> How about using "\n" instead of a newline?
> Or writing the string some other way to make it more readable?

FWIW, I sometimes do the following when writing tests:

gdb_test "info tasks" \
[join {" +ID +TID P-ID Pri State +Name" \
" +1 .* main_task" \
" +2 .* task_list\\(1\\)" \
"\\* +3 .* task_list\\(2\\)" \
" +4 .* task_list\\(3\\)"} \
"\r\n"] \
"info tasks after hitting breakpoint"

I find that having a multi-line expected output shown as multiple
lines is easier to understand than one ginormous string...

--
Joel