Date: Sun, 13 Mar 2011 16:20:39 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r219611 - head/tools/regression/bin/sh/expansion Message-ID: <201103131620.p2DGKddK059598@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Sun Mar 13 16:20:38 2011 New Revision: 219611 URL: http://svn.freebsd.org/changeset/base/219611 Log: sh: Add some tests for ${#parameter}. Added: head/tools/regression/bin/sh/expansion/length1.0 (contents, props changed) head/tools/regression/bin/sh/expansion/length2.0 (contents, props changed) head/tools/regression/bin/sh/expansion/length3.0 (contents, props changed) Added: head/tools/regression/bin/sh/expansion/length1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/length1.0 Sun Mar 13 16:20:38 2011 (r219611) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +v=abcd +[ "${#v}" = 4 ] || echo '${#v} wrong' +v=$$ +[ "${#$}" = "${#v}" ] || echo '${#$} wrong' +[ "${#!}" = 0 ] || echo '${#!} wrong' +set -- 01 2 3 4 5 6 7 8 9 10 11 12 0013 +[ "${#1}" = 2 ] || echo '${#1} wrong' +[ "${#13}" = 4 ] || echo '${#13} wrong' +v=$0 +[ "${#0}" = "${#v}" ] || echo '${#0} wrong' Added: head/tools/regression/bin/sh/expansion/length2.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/length2.0 Sun Mar 13 16:20:38 2011 (r219611) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +v=$- +[ "${#-}" = "${#v}" ] || echo '${#-} wrong' Added: head/tools/regression/bin/sh/expansion/length3.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/length3.0 Sun Mar 13 16:20:38 2011 (r219611) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +set -- 1 2 3 4 5 6 7 8 9 10 11 12 13 +[ "$#" = 13 ] || echo '$# wrong' +[ "${#}" = 13 ] || echo '${#} wrong' +[ "${##}" = 2 ] || echo '${##} wrong' +set -- +[ "$#" = 0 ] || echo '$# wrong' +[ "${#}" = 0 ] || echo '${#} wrong' +[ "${##}" = 1 ] || echo '${##} wrong'
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103131620.p2DGKddK059598>