Index: head/bin/sh/tests/expansion/Makefile =================================================================== --- head/bin/sh/tests/expansion/Makefile (revision 292757) +++ head/bin/sh/tests/expansion/Makefile (revision 292758) @@ -1,94 +1,95 @@ # $FreeBSD$ TESTSDIR= ${TESTSBASE}/bin/sh/${.CURDIR:T} .PATH: ${.CURDIR:H} ATF_TESTS_SH= functional_test FILESDIR= ${TESTSDIR} FILES= arith1.0 FILES+= arith2.0 FILES+= arith3.0 FILES+= arith4.0 FILES+= arith5.0 FILES+= arith6.0 FILES+= arith7.0 FILES+= arith8.0 FILES+= arith9.0 FILES+= arith10.0 FILES+= arith11.0 FILES+= arith12.0 FILES+= arith13.0 FILES+= arith14.0 FILES+= assign1.0 FILES+= cmdsubst1.0 FILES+= cmdsubst2.0 FILES+= cmdsubst3.0 FILES+= cmdsubst4.0 FILES+= cmdsubst5.0 FILES+= cmdsubst6.0 FILES+= cmdsubst7.0 FILES+= cmdsubst8.0 FILES+= cmdsubst9.0 FILES+= cmdsubst10.0 FILES+= cmdsubst11.0 FILES+= cmdsubst12.0 FILES+= cmdsubst13.0 FILES+= cmdsubst14.0 FILES+= cmdsubst15.0 FILES+= cmdsubst16.0 FILES+= cmdsubst17.0 FILES+= export1.0 FILES+= export2.0 FILES+= export3.0 FILES+= heredoc1.0 FILES+= heredoc2.0 FILES+= ifs1.0 FILES+= ifs2.0 FILES+= ifs3.0 FILES+= ifs4.0 FILES+= ifs5.0 FILES+= ifs6.0 FILES+= ifs7.0 FILES+= length1.0 FILES+= length2.0 FILES+= length3.0 FILES+= length4.0 FILES+= length5.0 FILES+= length6.0 FILES+= length7.0 FILES+= length8.0 FILES+= local1.0 FILES+= local2.0 FILES+= pathname1.0 FILES+= pathname2.0 FILES+= pathname3.0 FILES+= pathname4.0 FILES+= pathname5.0 FILES+= plus-minus1.0 FILES+= plus-minus2.0 FILES+= plus-minus3.0 FILES+= plus-minus4.0 FILES+= plus-minus5.0 FILES+= plus-minus6.0 FILES+= plus-minus7.0 FILES+= plus-minus8.0 FILES+= question1.0 FILES+= readonly1.0 FILES+= redir1.0 FILES+= set-u1.0 FILES+= set-u2.0 FILES+= set-u3.0 FILES+= tilde1.0 FILES+= tilde2.0 FILES+= trim1.0 FILES+= trim2.0 FILES+= trim3.0 FILES+= trim4.0 FILES+= trim5.0 FILES+= trim6.0 FILES+= trim7.0 FILES+= trim8.0 +FILES+= trim9.0 .include Index: head/bin/sh/tests/expansion/trim9.0 =================================================================== --- head/bin/sh/tests/expansion/trim9.0 (nonexistent) +++ head/bin/sh/tests/expansion/trim9.0 (revision 292758) @@ -0,0 +1,61 @@ +# $FreeBSD$ + +# POSIX does not specify these but they occasionally occur in the wild. +# This just serves to keep working what currently works. + +failures='' +ok='' + +testcase() { + code="$1" + expected="$2" + oIFS="$IFS" + eval "$code" + IFS='|' + result="$#|$*" + IFS="$oIFS" + if [ "x$result" = "x$expected" ]; then + ok=x$ok + else + failures=x$failures + echo "For $code, expected $expected actual $result" + fi +} + +testcase 'shift $#; set -- "${*#Q}"' '1|' +testcase 'shift $#; set -- "${*##Q}"' '1|' +testcase 'shift $#; set -- "${*%Q}"' '1|' +testcase 'shift $#; set -- "${*%%Q}"' '1|' +testcase 'set -- Q R; set -- "${*#Q}"' '1| R' +testcase 'set -- Q R; set -- "${*##Q}"' '1| R' +testcase 'set -- Q R; set -- "${*%R}"' '1|Q ' +testcase 'set -- Q R; set -- "${*%%R}"' '1|Q ' +testcase 'set -- Q R; set -- "${*#S}"' '1|Q R' +testcase 'set -- Q R; set -- "${*##S}"' '1|Q R' +testcase 'set -- Q R; set -- "${*%S}"' '1|Q R' +testcase 'set -- Q R; set -- "${*%%S}"' '1|Q R' +testcase 'set -- Q R; set -- ${*#Q}' '1|R' +testcase 'set -- Q R; set -- ${*##Q}' '1|R' +testcase 'set -- Q R; set -- ${*%R}' '1|Q' +testcase 'set -- Q R; set -- ${*%%R}' '1|Q' +testcase 'set -- Q R; set -- ${*#S}' '2|Q|R' +testcase 'set -- Q R; set -- ${*##S}' '2|Q|R' +testcase 'set -- Q R; set -- ${*%S}' '2|Q|R' +testcase 'set -- Q R; set -- ${*%%S}' '2|Q|R' +testcase 'set -- Q R; set -- ${@#Q}' '1|R' +testcase 'set -- Q R; set -- ${@##Q}' '1|R' +testcase 'set -- Q R; set -- ${@%R}' '1|Q' +testcase 'set -- Q R; set -- ${@%%R}' '1|Q' +testcase 'set -- Q R; set -- ${@#S}' '2|Q|R' +testcase 'set -- Q R; set -- ${@##S}' '2|Q|R' +testcase 'set -- Q R; set -- ${@%S}' '2|Q|R' +testcase 'set -- Q R; set -- ${@%%S}' '2|Q|R' +testcase 'set -- Q R; set -- "${@#Q}"' '2||R' +testcase 'set -- Q R; set -- "${@%R}"' '2|Q|' +testcase 'set -- Q R; set -- "${@%%R}"' '2|Q|' +testcase 'set -- Q R; set -- "${@#S}"' '2|Q|R' +testcase 'set -- Q R; set -- "${@##S}"' '2|Q|R' +testcase 'set -- Q R; set -- "${@%S}"' '2|Q|R' +testcase 'set -- Q R; set -- "${@%%S}"' '2|Q|R' + +test "x$failures" = x Property changes on: head/bin/sh/tests/expansion/trim9.0 ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property