| OLD | NEW |
| 1 # Copyright 2006-2012 Free Software Foundation, Inc. | 1 # Copyright 2006-2012 Free Software Foundation, Inc. |
| 2 | 2 |
| 3 # This program is free software; you can redistribute it and/or modify | 3 # This program is free software; you can redistribute it and/or modify |
| 4 # it under the terms of the GNU General Public License as published by | 4 # it under the terms of the GNU General Public License as published by |
| 5 # the Free Software Foundation; either version 3 of the License, or | 5 # the Free Software Foundation; either version 3 of the License, or |
| 6 # (at your option) any later version. | 6 # (at your option) any later version. |
| 7 # | 7 # |
| 8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
| 12 # | 12 # |
| 13 # You should have received a copy of the GNU General Public License | 13 # You should have received a copy of the GNU General Public License |
| 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | 15 |
| 16 # This test checks that the if .. else .. end construct works and may | 16 # This test checks that the if .. else .. end construct works and may |
| 17 # contain empty bodies without crashing. | 17 # contain empty bodies without crashing. |
| 18 | 18 |
| 19 if $tracelevel then { | |
| 20 strace $tracelevel | |
| 21 } | |
| 22 | |
| 23 gdb_exit | 19 gdb_exit |
| 24 gdb_start | 20 gdb_start |
| 25 | 21 |
| 26 # First test that the if command works with an empty body | 22 # First test that the if command works with an empty body |
| 27 # Test with different conditions because the body is ignored | 23 # Test with different conditions because the body is ignored |
| 28 # if it is not executed. | 24 # if it is not executed. |
| 29 | 25 |
| 30 # with true condition | 26 # with true condition |
| 31 set message "if 1 with empty body" | 27 set message "if 1 with empty body" |
| 32 gdb_test_multiple "if 1\nend" $message { | 28 gdb_test_multiple "if 1\nend" $message { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 # call (note that condition is 1 so should pass) | 94 # call (note that condition is 1 so should pass) |
| 99 gdb_test_no_output "abc" "call original define" | 95 gdb_test_no_output "abc" "call original define" |
| 100 # replace | 96 # replace |
| 101 set message "replace define with if .. else with empty body" | 97 set message "replace define with if .. else with empty body" |
| 102 gdb_test_multiple "define abc\necho got here\\n\nend" $message { | 98 gdb_test_multiple "define abc\necho got here\\n\nend" $message { |
| 103 -re "$gdb_prompt $" {pass $message} | 99 -re "$gdb_prompt $" {pass $message} |
| 104 eof {fail "$message (crashed)"} | 100 eof {fail "$message (crashed)"} |
| 105 } | 101 } |
| 106 # call | 102 # call |
| 107 gdb_test "abc" "got here" "call replacement define" | 103 gdb_test "abc" "got here" "call replacement define" |
| OLD | NEW |