From owner-svn-src-all@FreeBSD.ORG Sun Mar 18 13:02:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 610EA1065673; Sun, 18 Mar 2012 13:02:57 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E35D8FC18; Sun, 18 Mar 2012 13:02:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2ID2vDD020204; Sun, 18 Mar 2012 13:02:57 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2ID2vsD020197; Sun, 18 Mar 2012 13:02:57 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201203181302.q2ID2vsD020197@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 18 Mar 2012 13:02:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233116 - in stable/9/tools/regression/bin/sh: builtins expansion parameters X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2012 13:02:57 -0000 Author: jilles Date: Sun Mar 18 13:02:56 2012 New Revision: 233116 URL: http://svn.freebsd.org/changeset/base/233116 Log: MFC r226892,r228007,r228873,r230121,r232839: sh: Various testcases that already work. Added: stable/9/tools/regression/bin/sh/builtins/case11.0 - copied unchanged from r228007, head/tools/regression/bin/sh/builtins/case11.0 stable/9/tools/regression/bin/sh/builtins/case12.0 - copied unchanged from r228007, head/tools/regression/bin/sh/builtins/case12.0 stable/9/tools/regression/bin/sh/builtins/for1.0 - copied unchanged from r226892, head/tools/regression/bin/sh/builtins/for1.0 stable/9/tools/regression/bin/sh/expansion/arith12.0 - copied unchanged from r232839, head/tools/regression/bin/sh/expansion/arith12.0 stable/9/tools/regression/bin/sh/expansion/cmdsubst12.0 - copied unchanged from r230121, head/tools/regression/bin/sh/expansion/cmdsubst12.0 stable/9/tools/regression/bin/sh/expansion/cmdsubst13.0 - copied unchanged from r230121, head/tools/regression/bin/sh/expansion/cmdsubst13.0 stable/9/tools/regression/bin/sh/parameters/positional2.0 - copied unchanged from r228873, head/tools/regression/bin/sh/parameters/positional2.0 Modified: Directory Properties: stable/9/tools/regression/bin/sh/ (props changed) Copied: stable/9/tools/regression/bin/sh/builtins/case11.0 (from r228007, head/tools/regression/bin/sh/builtins/case11.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/bin/sh/builtins/case11.0 Sun Mar 18 13:02:56 2012 (r233116, copy of r228007, head/tools/regression/bin/sh/builtins/case11.0) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +false +case x in +*) +esac Copied: stable/9/tools/regression/bin/sh/builtins/case12.0 (from r228007, head/tools/regression/bin/sh/builtins/case12.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/bin/sh/builtins/case12.0 Sun Mar 18 13:02:56 2012 (r233116, copy of r228007, head/tools/regression/bin/sh/builtins/case12.0) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +false +case x in +y) +esac Copied: stable/9/tools/regression/bin/sh/builtins/for1.0 (from r226892, head/tools/regression/bin/sh/builtins/for1.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/bin/sh/builtins/for1.0 Sun Mar 18 13:02:56 2012 (r233116, copy of r226892, head/tools/regression/bin/sh/builtins/for1.0) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +false +for i in `false`; do exit 3; done Copied: stable/9/tools/regression/bin/sh/expansion/arith12.0 (from r232839, head/tools/regression/bin/sh/expansion/arith12.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/bin/sh/expansion/arith12.0 Sun Mar 18 13:02:56 2012 (r233116, copy of r232839, head/tools/regression/bin/sh/expansion/arith12.0) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +_x=4 y_=5 z_z=6 +[ "$((_x*100+y_*10+z_z))" = 456 ] Copied: stable/9/tools/regression/bin/sh/expansion/cmdsubst12.0 (from r230121, head/tools/regression/bin/sh/expansion/cmdsubst12.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/bin/sh/expansion/cmdsubst12.0 Sun Mar 18 13:02:56 2012 (r233116, copy of r230121, head/tools/regression/bin/sh/expansion/cmdsubst12.0) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +f() { + echo x$(printf foo >&2)y +} +[ "$(f 2>&1)" = "fooxy" ] Copied: stable/9/tools/regression/bin/sh/expansion/cmdsubst13.0 (from r230121, head/tools/regression/bin/sh/expansion/cmdsubst13.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/bin/sh/expansion/cmdsubst13.0 Sun Mar 18 13:02:56 2012 (r233116, copy of r230121, head/tools/regression/bin/sh/expansion/cmdsubst13.0) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +x=1 y=2 +[ "$( + case $((x+=1)) in + ($((y+=1))) echo bad1 ;; + ($((y-1))) echo $x.$y ;; + ($((y=2))) echo bad2 ;; + (*) echo bad3 ;; + esac +)" = "2.3" ] || echo "Error at $LINENO" +[ "$x.$y" = "1.2" ] || echo "Error at $LINENO" Copied: stable/9/tools/regression/bin/sh/parameters/positional2.0 (from r228873, head/tools/regression/bin/sh/parameters/positional2.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/bin/sh/parameters/positional2.0 Sun Mar 18 13:02:56 2012 (r233116, copy of r228873, head/tools/regression/bin/sh/parameters/positional2.0) @@ -0,0 +1,65 @@ +# $FreeBSD$ + +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 'set -- a b; set -- p$@q' '2|pa|bq' +testcase 'set -- a b; set -- $@q' '2|a|bq' +testcase 'set -- a b; set -- p$@' '2|pa|b' +testcase 'set -- a b; set -- p$@q' '2|pa|bq' +testcase 'set -- a b; set -- $@q' '2|a|bq' +testcase 'set -- a b; set -- p$@' '2|pa|b' +testcase 'set -- a b; set -- p$*q' '2|pa|bq' +testcase 'set -- a b; set -- $*q' '2|a|bq' +testcase 'set -- a b; set -- p$*' '2|pa|b' +testcase 'set -- a b; set -- p$*q' '2|pa|bq' +testcase 'set -- a b; set -- $*q' '2|a|bq' +testcase 'set -- a b; set -- p$*' '2|pa|b' +testcase 'set -- a b; set -- "p$@q"' '2|pa|bq' +testcase 'set -- a b; set -- "$@q"' '2|a|bq' +testcase 'set -- a b; set -- "p$@"' '2|pa|b' +testcase 'set -- a b; set -- p"$@"q' '2|pa|bq' +testcase 'set -- a b; set -- "$@"q' '2|a|bq' +testcase 'set -- a b; set -- p"$@"' '2|pa|b' +testcase 'set -- "" a b; set -- "p$@q"' '3|p|a|bq' +testcase 'set -- "" a b; set -- "$@q"' '3||a|bq' +testcase 'set -- "" a b; set -- "p$@"' '3|p|a|b' +testcase 'set -- "" a b; set -- p"$@"q' '3|p|a|bq' +testcase 'set -- "" a b; set -- "$@"q' '3||a|bq' +testcase 'set -- "" a b; set -- p"$@"' '3|p|a|b' +testcase 'set -- a; set -- p$@q' '1|paq' +testcase 'set -- a; set -- $@q' '1|aq' +testcase 'set -- a; set -- p$@' '1|pa' +testcase 'set -- a; set -- p$@q' '1|paq' +testcase 'set -- a; set -- $@q' '1|aq' +testcase 'set -- a; set -- p$@' '1|pa' +testcase 'set -- a; set -- p$*q' '1|paq' +testcase 'set -- a; set -- $*q' '1|aq' +testcase 'set -- a; set -- p$*' '1|pa' +testcase 'set -- a; set -- p$*q' '1|paq' +testcase 'set -- a; set -- $*q' '1|aq' +testcase 'set -- a; set -- p$*' '1|pa' +testcase 'set -- a; set -- "p$@q"' '1|paq' +testcase 'set -- a; set -- "$@q"' '1|aq' +testcase 'set -- a; set -- "p$@"' '1|pa' +testcase 'set -- a; set -- p"$@"q' '1|paq' +testcase 'set -- a; set -- "$@"q' '1|aq' +testcase 'set -- a; set -- p"$@"' '1|pa' + +test "x$failures" = x