Date: Wed, 7 May 2014 21:45:25 +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: r265616 - head/bin/sh/tests/builtins Message-ID: <201405072145.s47LjPpg004492@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Wed May 7 21:45:25 2014 New Revision: 265616 URL: http://svnweb.freebsd.org/changeset/base/265616 Log: sh: Add some tests for normal use of getopts. Added: head/bin/sh/tests/builtins/getopts3.0 (contents, props changed) head/bin/sh/tests/builtins/getopts4.0 (contents, props changed) head/bin/sh/tests/builtins/getopts5.0 (contents, props changed) Modified: head/bin/sh/tests/builtins/Makefile Modified: head/bin/sh/tests/builtins/Makefile ============================================================================== --- head/bin/sh/tests/builtins/Makefile Wed May 7 21:39:01 2014 (r265615) +++ head/bin/sh/tests/builtins/Makefile Wed May 7 21:45:25 2014 (r265616) @@ -80,6 +80,9 @@ FILES+= for2.0 FILES+= for3.0 FILES+= getopts1.0 getopts1.0.stdout FILES+= getopts2.0 getopts2.0.stdout +FILES+= getopts3.0 +FILES+= getopts4.0 +FILES+= getopts5.0 FILES+= hash1.0 hash1.0.stdout FILES+= hash2.0 hash2.0.stdout FILES+= hash3.0 hash3.0.stdout Added: head/bin/sh/tests/builtins/getopts3.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/builtins/getopts3.0 Wed May 7 21:45:25 2014 (r265616) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +shift $# +getopts x opt +r=$? +[ "$r" != 0 ] && [ "$OPTIND" = 1 ] Added: head/bin/sh/tests/builtins/getopts4.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/builtins/getopts4.0 Wed May 7 21:45:25 2014 (r265616) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +set -- -x +opt=not +getopts x opt +r1=$? OPTIND1=$OPTIND opt1=$opt +getopts x opt +r2=$? OPTIND2=$OPTIND +[ "$r1" = 0 ] && [ "$OPTIND1" = 2 ] && [ "$opt1" = x ] && [ "$r2" != 0 ] && + [ "$OPTIND2" = 2 ] Added: head/bin/sh/tests/builtins/getopts5.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/builtins/getopts5.0 Wed May 7 21:45:25 2014 (r265616) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +set -- -x arg +opt=not +getopts x opt +r1=$? OPTIND1=$OPTIND opt1=$opt +getopts x opt +r2=$? OPTIND2=$OPTIND +[ "$r1" = 0 ] && [ "$OPTIND1" = 2 ] && [ "$opt1" = x ] && [ "$r2" != 0 ] && + [ "$OPTIND2" = 2 ]
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405072145.s47LjPpg004492>