From owner-svn-src-head@FreeBSD.ORG Wed May 7 21:45:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A03AD2AD; Wed, 7 May 2014 21:45:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 731C520A; Wed, 7 May 2014 21:45:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s47LjQe2004498; Wed, 7 May 2014 21:45:26 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s47LjPpg004492; Wed, 7 May 2014 21:45:25 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201405072145.s47LjPpg004492@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 7 May 2014 21:45:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r265616 - head/bin/sh/tests/builtins X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 May 2014 21:45:26 -0000 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 ]