diff options
Diffstat (limited to 'gdb/testsuite/gdb.python/py-cmd.exp')
-rw-r--r-- | gdb/testsuite/gdb.python/py-cmd.exp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.python/py-cmd.exp b/gdb/testsuite/gdb.python/py-cmd.exp index d3c05ff..0f250d2 100644 --- a/gdb/testsuite/gdb.python/py-cmd.exp +++ b/gdb/testsuite/gdb.python/py-cmd.exp @@ -126,3 +126,35 @@ gdb_py_test_multiple "input new subcommand" \ "end" "" gdb_test "info newsubcmd ugh" "newsubcmd output, arg = ugh" "call newsubcmd" + +# Test a command that throws gdb.GdbError. + +gdb_py_test_multiple "input command to throw error" \ + "python" "" \ + "class test_error_cmd (gdb.Command):" "" \ + " def __init__ (self):" "" \ + " super (test_error_cmd, self).__init__ (\"test_error_cmd\", gdb.COMMAND_OBSCURE)" "" \ + " def invoke (self, arg, from_tty):" "" \ + " raise gdb.GdbError ('you lose!')" "" \ + "test_error_cmd ()" "" \ + "end" "" + +gdb_test "test_error_cmd ugh" "you lose!" "call error command" + +# Test gdb.string_to_argv. + +gdb_test "python print gdb.string_to_argv (\"1 2 3\")" \ + {\['1', '2', '3'\]} \ + "string_to_argv (\"1 2 3\")" + +gdb_test "python print gdb.string_to_argv (\"'1 2' 3\")" \ + {\['1 2', '3'\]} \ + "string_to_argv (\"'1 2' 3\")" + +gdb_test "python print gdb.string_to_argv ('\"1 2\" 3')" \ + {\['1 2', '3'\]} \ + "string_to_argv ('\"1 2\" 3')" + +gdb_test "python print gdb.string_to_argv ('1\\ 2 3')" \ + {\['1 2', '3'\]} \ + "string_to_argv ('1\\ 2 3')" |