This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]