aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2004-09-10 23:12:12 +0000
committerJason Molenda <jmolenda@apple.com>2004-09-10 23:12:12 +0000
commit33f2d567787fbbb2103a462d0f10678a3e9af211 (patch)
tree04c56d924e1800dba8ec2e9e4e6022bc0069e615 /gdb/testsuite
parentf4eae89cf7214078d2e9b5c2ab5f50e74c5f1d0f (diff)
downloadgdb-33f2d567787fbbb2103a462d0f10678a3e9af211.zip
gdb-33f2d567787fbbb2103a462d0f10678a3e9af211.tar.gz
gdb-33f2d567787fbbb2103a462d0f10678a3e9af211.tar.bz2
[gdb/ChangeLog]
2004-09-10 Jason Molenda (jmolenda@apple.com) * cli/cli-script.c (read_next_line): Accept zero or more whitespace chars after 'if' or 'while' commands in user-defined commands. [gdb/testsuite/ChangeLog] 2004-09-10 Jason Molenda (jmolenda@apple.com) * gdb.base/define.exp: Two new tests to verify zero space chars after 'if' and 'while' commands in a user-defined command is correctly parsed. Approved here: http://sources.redhat.com/ml/gdb-patches/2004-09/msg00160.html http://sources.redhat.com/ml/gdb-patches/2004-09/msg00157.html
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.base/define.exp36
2 files changed, 41 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index b225ae3..e18a407 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2004-09-10 Jason Molenda (jmolenda@apple.com)
+
+ * gdb.base/define.exp: Two new tests to verify zero space chars
+ after 'if' and 'while' commands in a user-defined command is correctly
+ parsed.
+
2004-09-08 Andrew Cagney <cagney@gnu.org>
* gdb.base/signals.exp (signal_tests_1): Delete. Merge signal
diff --git a/gdb/testsuite/gdb.base/define.exp b/gdb/testsuite/gdb.base/define.exp
index 7e948f1..74682fe 100644
--- a/gdb/testsuite/gdb.base/define.exp
+++ b/gdb/testsuite/gdb.base/define.exp
@@ -1,4 +1,4 @@
-# Copyright 1998, 1999, 2001, 2003 Free Software Foundation, Inc.
+# Copyright 1998, 1999, 2001, 2003, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -200,6 +200,40 @@ gdb_expect {
timeout {fail "(timeout) help user command: nextwhere"}
}
+# Verify that the command parser doesn't require a space after an 'if'
+# command in a user defined function.
+#
+gdb_test_multiple "define ifnospace" "define user command: ifnospace" \
+{
+ -re "Type commands for definition of \"ifnospace\".\r\nEnd with a line saying just \"end\".\r\n>$" \
+ {
+ gdb_test_multiple "if(3<4)\nprint \"hi there\\n\"\nend\nend" "send body of ifnospace" \
+ {
+ -re "$gdb_prompt $"\
+ {pass "define user command: ifnospace"}
+ }
+ }
+}
+
+gdb_test "ifnospace" ".*hi there.*" "test ifnospace is parsed correctly"
+
+# Verify that the command parser doesn't require a space after an 'while'
+# command in a user defined function.
+#
+gdb_test_multiple "define whilenospace" "define user command: whilenospace" \
+{
+ -re "Type commands for definition of \"whilenospace\".\r\nEnd with a line saying just \"end\".\r\n>$" \
+ {
+ gdb_test_multiple "set \$i=1\nwhile(\$i<2)\nset \$i=2\nprint \"hi there\\n\"\nend\nend" "send body of whilenospace" \
+ {
+ -re "$gdb_prompt $" \
+ {pass "define user command: whilenospace"}
+ }
+ }
+}
+
+gdb_test "whilenospace" ".*hi there.*" "test whilenospace is parsed correctly"
+
# Verify that the user can "hook" a builtin command. We choose to
# hook the "stop" pseudo command, and we'll define it to use a user-
# define command.