Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/bin/sh Add new redirection test, from kre



details:   https://anonhg.NetBSD.org/src/rev/f1b2a8ca8cd1
branches:  trunk
changeset: 813865:f1b2a8ca8cd1
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Feb 23 14:21:37 2016 +0000

description:
Add new redirection test, from kre

diffstat:

 tests/bin/sh/t_redir.sh |  23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diffs (46 lines):

diff -r f937dbd8a29c -r f1b2a8ca8cd1 tests/bin/sh/t_redir.sh
--- a/tests/bin/sh/t_redir.sh   Tue Feb 23 11:43:57 2016 +0000
+++ b/tests/bin/sh/t_redir.sh   Tue Feb 23 14:21:37 2016 +0000
@@ -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 @@
                        "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
 }



Home | Main Index | Thread Index | Old Index