diff options
Diffstat (limited to 'gdb/testsuite/gdb.base/cond-expr.exp')
-rw-r--r-- | gdb/testsuite/gdb.base/cond-expr.exp | 55 |
1 files changed, 12 insertions, 43 deletions
diff --git a/gdb/testsuite/gdb.base/cond-expr.exp b/gdb/testsuite/gdb.base/cond-expr.exp index 1bb6a00..76635e0 100644 --- a/gdb/testsuite/gdb.base/cond-expr.exp +++ b/gdb/testsuite/gdb.base/cond-expr.exp @@ -55,57 +55,26 @@ if ![runto_main] then { continue } -send_gdb "print (2 ? 3 : 4)\n" -gdb_expect { - -re ".\[0-9\]* = 3.*$gdb_prompt $" { - pass "print value of cond expr (const true)" - } - -re ".*$gdb_prompt $" { fail "print value of cond expr (const true)" } - timeout { fail "(timeout) print value of cond expr (const true)" } - } - -send_gdb "print (0 ? 3 : 4)\n" -gdb_expect { - -re ".\[0-9\]* = 4.*$gdb_prompt $" { - pass "print value of cond expr (const false)" - } - -re ".*$gdb_prompt $" { fail "print value of cond expr (const false)" } - timeout { fail "(timeout) print value of cond expr (const false)" } - } +gdb_test "print (2 ? 3 : 4)" "\[0-9\]* = 3" \ + "print value of cond expr (const true)" + +gdb_test "print (0 ? 3 : 4)" "\[0-9\]* = 4" \ + "print value of cond expr (const false)" gdb_test "set variable x=14" "" "set variable x=14" gdb_test "set variable y=2" "" "set variable y=2" gdb_test "set variable z=3" "" "set variable z=3" -send_gdb "print (x ? y : z)\n" -gdb_expect { - -re ".\[0-9\]* = 2.*$gdb_prompt $" { - pass "print value of cond expr (var true)" - } - -re ".*$gdb_prompt $" { fail "print value of cond expr (var true)" } - timeout { fail "(timeout) print value of cond expr (var true)" } - } +gdb_test "print (x ? y : z)" "\[0-9\]* = 2" \ + "print value of cond expr (var true)" gdb_test "set variable x=0" "" "set variable x=0" -send_gdb "print (x ? y : z)\n" -gdb_expect { - -re ".\[0-9\]* = 3.*$gdb_prompt $" { - pass "print value of cond expr (var false)" - } - -re ".*$gdb_prompt $" { fail "print value of cond expr (var false)" } - timeout { fail "(timeout) print value of cond expr (var false)" } - } - - -send_gdb "whatis (0 ? 3 : 4)\n" -gdb_expect { - -re "type = int.*$gdb_prompt $" { - pass "print whatis of cond expr" - } - -re ".*$gdb_prompt $" { fail "print whatis of cond expr" } - timeout { fail "(timeout) print whatis of cond expr" } - } +gdb_test "print (x ? y : z)" "\[0-9\]* = 3" \ + "print value of cond expr (var false)" + +gdb_test "whatis (0 ? 3 : 4)" "type = int" \ + "print whatis of cond expr" |