sh: Add tests for sh -c that already pass.

PR:		220587
Submitted by:	Ryan Moeller
This commit is contained in:
Jilles Tjoelker 2017-08-12 19:17:48 +00:00
parent 992029ba10
commit 2cc32af06f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=322438
7 changed files with 43 additions and 0 deletions

View file

@ -6,6 +6,7 @@ TESTS_SUBDIRS+= builtins
TESTS_SUBDIRS+= errors
TESTS_SUBDIRS+= execution
TESTS_SUBDIRS+= expansion
TESTS_SUBDIRS+= invocation
TESTS_SUBDIRS+= parameters
TESTS_SUBDIRS+= parser
TESTS_SUBDIRS+= set-e

View file

@ -0,0 +1,15 @@
# $FreeBSD$
PACKAGE= tests
TESTSDIR= ${TESTSBASE}/bin/sh/${.CURDIR:T}
.PATH: ${.CURDIR:H}
ATF_TESTS_SH= functional_test
${PACKAGE}FILES+= sh-ac1.0
${PACKAGE}FILES+= sh-c1.0
${PACKAGE}FILES+= sh-ca1.0
${PACKAGE}FILES+= sh-fca1.0
.include <bsd.test.mk>

View file

@ -0,0 +1,7 @@
# $FreeBSD$
# Test that attached options before c are processed
case `${SH} -ac 'echo $-:$0' moo` in
*a*:moo) true ;;
*) false ;;
esac

View file

@ -0,0 +1,4 @@
# $FreeBSD$
# Test that -c executes command_string with the given name and arg
${SH} -c 'echo $0 $@' moo foo | grep -qx -- "moo foo"

View file

@ -0,0 +1,7 @@
# $FreeBSD$
# Test that attached options after c are processed
case `${SH} -ca 'echo $-:$0' moo` in
*a*:moo) true ;;
*) false ;;
esac

View file

@ -0,0 +1,7 @@
# $FreeBSD$
# Test that attached options before and after c are processed
case `${SH} -fca 'echo $-:$-:$0:$@' foo -bar` in
*f*:*a*:foo:-bar) true ;;
*) false ;;
esac

View file

@ -39,6 +39,8 @@
..
expansion
..
invocation
..
parameters
..
parser