From owner-svn-src-stable@FreeBSD.ORG Sat May 15 12:51:23 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63AF5106564A; Sat, 15 May 2010 12:51:23 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 388C98FC18; Sat, 15 May 2010 12:51:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4FCpNjq080518; Sat, 15 May 2010 12:51:23 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4FCpN39080517; Sat, 15 May 2010 12:51:23 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201005151251.o4FCpN39080517@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 15 May 2010 12:51:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208113 - stable/8/tools/regression/bin/sh/expansion X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2010 12:51:23 -0000 Author: jilles Date: Sat May 15 12:51:22 2010 New Revision: 208113 URL: http://svn.freebsd.org/changeset/base/208113 Log: MFC r207935: sh: Add some simple testcases for pathname expansion. Added: stable/8/tools/regression/bin/sh/expansion/pathname1.0 - copied unchanged from r207935, head/tools/regression/bin/sh/expansion/pathname1.0 Modified: Directory Properties: stable/8/tools/regression/bin/sh/ (props changed) Copied: stable/8/tools/regression/bin/sh/expansion/pathname1.0 (from r207935, head/tools/regression/bin/sh/expansion/pathname1.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/expansion/pathname1.0 Sat May 15 12:51:22 2010 (r208113, copy of r207935, head/tools/regression/bin/sh/expansion/pathname1.0) @@ -0,0 +1,61 @@ +# $FreeBSD$ + +failures=0 + +check() { + testcase=$1 + expect=$2 + eval "set -- $testcase" + actual="$*" + if [ "$actual" != "$expect" ]; then + failures=$((failures+1)) + printf '%s\n' "For $testcase, expected $expect actual $actual" + fi +} + +set -e +T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX) +trap 'rm -rf $T' 0 +cd -P $T + +mkdir testdir testdir2 'testdir/*' 'testdir/?' testdir/a testdir/b testdir2/b +mkdir testdir2/.c +touch testf 'testdir/*/1' 'testdir/?/1' testdir/a/1 testdir/b/1 testdir2/b/.a + +check '' '' +check 'testdir/b' 'testdir/b' +check 'testdir/c' 'testdir/c' +check '\*' '*' +check '\?' '?' +check '*' 'testdir testdir2 testf' +check '*""' 'testdir testdir2 testf' +check '""*' 'testdir testdir2 testf' +check '*/' 'testdir/ testdir2/' +check 'testdir*/a' 'testdir/a' +check 'testdir*/b' 'testdir/b testdir2/b' +check '*/.c' 'testdir2/.c' +check 'testdir2/*' 'testdir2/b' +check 'testdir2/b/*' 'testdir2/b/*' +check 'testdir/*' 'testdir/* testdir/? testdir/a testdir/b' +check 'testdir/*/1' 'testdir/*/1 testdir/?/1 testdir/a/1 testdir/b/1' +check '"testdir/"*/1' 'testdir/*/1 testdir/?/1 testdir/a/1 testdir/b/1' +check 'testdir/\*/*' 'testdir/*/1' +check 'testdir/\?/*' 'testdir/?/1' +check 'testdir/"?"/*' 'testdir/?/1' +check '"testdir"/"?"/*' 'testdir/?/1' +check '"testdir"/"?"*/*' 'testdir/?/1' +check '"testdir"/*"?"/*' 'testdir/?/1' +check '"testdir/?"*/*' 'testdir/?/1' +check 'testdir/\*/' 'testdir/*/' +check 'testdir/\?/' 'testdir/?/' +check 'testdir/"?"/' 'testdir/?/' +check '"testdir"/"?"/' 'testdir/?/' +check '"testdir"/"?"*/' 'testdir/?/' +check '"testdir"/*"?"/' 'testdir/?/' +check '"testdir/?"*/' 'testdir/?/' +check 'testdir/[*]/' 'testdir/*/' +check 'testdir/[?]/' 'testdir/?/' +check 'testdir/[*?]/' 'testdir/*/ testdir/?/' +check '[tz]estdir/[*]/' 'testdir/*/' + +exit $((failures != 0))