aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/exprs.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.base/exprs.exp')
-rw-r--r--gdb/testsuite/gdb.base/exprs.exp9
1 files changed, 9 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/exprs.exp b/gdb/testsuite/gdb.base/exprs.exp
index e84bf31..25ba687 100644
--- a/gdb/testsuite/gdb.base/exprs.exp
+++ b/gdb/testsuite/gdb.base/exprs.exp
@@ -253,3 +253,12 @@ gdb_test "set output-radix 8" ".*"
test_expr "print red" "\\$\[0-9\]* = red"
test_expr "print/d red" "\\$\[0-9\]* = 0"
gdb_test "set output-radix 10" ".*"
+
+# Pre-/post in-/decrement tests.
+gdb_test "set variable v_int = 1" ""
+gdb_test "print v_int++" "\\$\[0-9\]* = 1"
+gdb_test "print ++v_int" "\\$\[0-9\]* = 3"
+gdb_test "print v_int--" "\\$\[0-9\]* = 3"
+gdb_test "print --v_int" "\\$\[0-9\]* = 1"
+gdb_test "print v_int++ = 5" "Left operand of assignment is not an lvalue."
+gdb_test "print v_int-- = 5" "Left operand of assignment is not an lvalue."