[RFC/TESTSUITE] completion.exp
Elena Zannoni
ezannoni@redhat.com
Wed Apr 9 20:14:00 GMT 2003
David Carlton writes:
> On Tue, 8 Apr 2003 19:29:01 -0400, Elena Zannoni <ezannoni@redhat.com> said:
>
> > +# If the directory name contains a '+' we must escape it, adding a backslash.
> > +# If not, the test below will fail because it will interpret the '+' as a
> > +# regext operator.
> > +regsub -all \\+ ${fullsrcdir} \\\+ dirstring
>
> Would it be better to use string_to_regexp instead of regsub? (But
> leaving in the comment as an indication of why you're using it.)
>
Ah, I didn't know about string_to_regexp. Yes, definitely, thank you.
How's this?
elena
Index: completion.exp
===================================================================
RCS file: /cvs/uberbaum/gdb/testsuite/gdb.base/completion.exp,v
retrieving revision 1.14
diff -u -p -r1.14 completion.exp
--- completion.exp 4 Jan 2003 22:37:49 -0000 1.14
+++ completion.exp 9 Apr 2003 20:11:44 -0000
@@ -669,7 +669,14 @@ cd ${srcdir}
set fullsrcdir [pwd]
cd ${mydir}
-gdb_test "cd ${fullsrcdir}" "Working directory ${fullsrcdir}.*" "cd to \${srcdir}"
+# If the directory name contains a '+' we must escape it, adding a backslash.
+# If not, the test below will fail because it will interpret the '+' as a
+# regexp operator. We use string_to_regexp for this purpose.
+
+gdb_test "cd ${fullsrcdir}" \
+ "Working directory [string_to_regexp ${fullsrcdir}].*" \
+ "cd to \${srcdir}"
+
send_gdb "file ./gdb.base/compl\t"
sleep 1
gdb_expect {
More information about the Gdb-patches
mailing list