Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/bin/sh It turns out there are more cases where escapin...



details:   https://anonhg.NetBSD.org/src/rev/fb824e952ad4
branches:  trunk
changeset: 837066:fb824e952ad4
user:      kre <kre%NetBSD.org@localhost>
date:      Sun Nov 18 13:41:24 2018 +0000

description:
It turns out there are more cases where escaping of meta-chars
was not being done properly (too many different code paths inside sh)
so add even more subtests to the case_matching test case to verify
that all (that I can think of for now anyway) get fixed when this
gets cleaned up.   The case_matching test case still fails, but now
6 of its subtests should fail (until sh is corrected ... soon).

diffstat:

 tests/bin/sh/t_patterns.sh |  28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)

diffs (42 lines):

diff -r 48e409e3981d -r fb824e952ad4 tests/bin/sh/t_patterns.sh
--- a/tests/bin/sh/t_patterns.sh        Sun Nov 18 11:48:56 2018 +0000
+++ b/tests/bin/sh/t_patterns.sh        Sun Nov 18 13:41:24 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_patterns.sh,v 1.3 2018/11/18 01:24:44 kre Exp $
+# $NetBSD: t_patterns.sh,v 1.4 2018/11/18 13:41:24 kre Exp $
 #
 # Copyright (c) 2018 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -675,10 +675,28 @@
        # The first of the "set" tests pair was reported as broken bu
        # Martijn Dekker (private mail) (Nov 2018).
 
-       cm "'\'" "'\'"                                                  #262
-       cm "'\'" '"$var"' "var='\\'"; cf "'\'" '$var' "var='\\'"        #264
-       cm '$1' '"$2"' 'set -- \\ \\'; cf '$1' '$2' 'set -- \\ \\'      #266
-       cf '$1' '"$2"' 'set -- \\ \\\\'; cm '$1' '$2' 'set -- \\ \\\\'  #268
+       cm "'\\'" "'\\'"; cf "'\\'" "'\\\\'"                            #263
+       cm "'\\'" '"$var"' "var='\\'"; cf "'\\'" '$var' "var='\\'"      #265
+       cm '$1' '"$2"' 'set -- \\ \\'; cf '$1' '$2' 'set -- \\ \\'      #267
+       cf '$1' '"$2"' 'set -- \\ \\\\'; cm '$1' '$2' 'set -- \\ \\\\'  #269
+       cm "'\\'" "\$( echo '\\\\' )"; cf "'\\'" "\$( echo '\\' )"      #271
+       cm "'\\'" "\"\$( echo '\\' )\""                                 #272
+       cf "'\\'" "\"\$( echo '\\\\' )\""                               #273
+
+       if X=$( ${TEST_SH} -c 'printf %s '"\$'\\\\'" 2>/dev/null ) &&
+           [ "$X" = '\' ]
+       then
+               # TEST_SH supports $'...' so we can test it as well
+               # note these are $'\\' and $'\\\\' as patterns.
+               # They should be identical to '\' and '\\'
+               cm "'\\'" "\$'\\\\'"; cf "'\\'" "\$'\\\\\\\\'"          #275
+       else
+               # uncomment this if we need to keep sub-test numbering sane
+               # it isn't needed as long as this remains last.
+               # (nb: this is just a repeat of sub-test 263)
+
+               # cm "'\\'" "'\\'"; cf "'\\'" "'\\\\'"                  #275
+       fi
 
        results
 }



Home | Main Index | Thread Index | Old Index