Module Name:    src
Committed By:   christos
Date:           Tue Feb 23 14:21:37 UTC 2016

Modified Files:
        src/tests/bin/sh: t_redir.sh

Log Message:
Add new redirection test, from kre


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/bin/sh/t_redir.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/bin/sh/t_redir.sh
diff -u src/tests/bin/sh/t_redir.sh:1.1 src/tests/bin/sh/t_redir.sh:1.2
--- src/tests/bin/sh/t_redir.sh:1.1	Mon Feb 22 14:52:03 2016
+++ src/tests/bin/sh/t_redir.sh	Tue Feb 23 09:21:37 2016
@@ -1,4 +1,4 @@
-# $NetBSD: t_redir.sh,v 1.1 2016/02/22 19:52:03 christos Exp $
+# $NetBSD: t_redir.sh,v 1.2 2016/02/23 14:21:37 christos Exp $
 #
 # Copyright (c) 2016 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -24,6 +24,8 @@
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
 #
+# the implementation of "sh" to test
+: ${TEST_SH:="/bin/sh"}
 
 atf_test_case redir_in_case
 redir_in_case_head() {
@@ -31,10 +33,25 @@ redir_in_case_head() {
 	                "in case statements. (PR bin/48631)"
 }
 redir_in_case_body() {
-	atf_check -s exit:0 -o ignore -e ignore \
-	    -x '/bin/sh -c "case x in (whatever) >foo;; esac"'
+	atf_check -s exit:0 -o empty -e empty \
+	    ${TEST_SH} -c 'case x in (whatever) >foo;; esac'
+}
+
+atf_test_case redir_here_doc
+redir_here_doc_head() {
+	atf_set "descr" "Tests that sh(1) correctly processes 'here' doc " \
+	                "input redirections"
+}
+redir_here_doc_body() {
+	atf_check -s exit:0 -o match:'hello\\n' -e empty \
+		"${TEST_SH}" -ec '{
+					echo "cat <<EOF"
+					echo '"'"'"hello\n"'"'"'
+					echo "EOF"
+				} | '"'${TEST_SH}'"' -e'
 }
 
 atf_init_test_cases() {
 	atf_add_test_case redir_in_case
+	atf_add_test_case redir_here_doc
 }

Reply via email to