Module Name: src Committed By: kre Date: Thu Sep 9 00:04:51 UTC 2021
Modified Files: src/tests/bin/sh: t_here.sh Log Message: Add a new test case to check for correct parsing and execution of a few bizarre here document usages, such as : << do | for x in xxx do do echo $x done which should work, but never have done. (See the source for others). This test case will currently fail, until the bug is fixed (already done, to be committed very soon). To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/bin/sh/t_here.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_here.sh diff -u src/tests/bin/sh/t_here.sh:1.7 src/tests/bin/sh/t_here.sh:1.8 --- src/tests/bin/sh/t_here.sh:1.7 Tue Jan 22 14:31:53 2019 +++ src/tests/bin/sh/t_here.sh Thu Sep 9 00:04:51 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_here.sh,v 1.7 2019/01/22 14:31:53 kre Exp $ +# $NetBSD: t_here.sh,v 1.8 2021/09/09 00:04:51 kre Exp $ # # Copyright (c) 2007 The NetBSD Foundation, Inc. # All rights reserved. @@ -530,6 +530,35 @@ side_effects_body() { ' } +# The following tests a problem reported on the austin-list 2021-09-08 +# by oguzismailuy...@gmail.com ... it affected all ash derived shells +atf_test_case hard_cases +hard_cases_head() { + atf_set "descr" \ + "Tests here docs in positions that have confised our parser" +} +hard_cases_body() { + + atf_check -s exit:0 -o inline:'xxx\n' -e empty ${TEST_SH} -c ' + : <<- do | for x in xxx + do + do echo $x + done' + + atf_check -s exit:0 -o inline:'xxx\n' -e empty ${TEST_SH} -c ' + set -- xxx + : <<- done | for x in xxx + done + do echo $x + done' + + atf_check -s exit:0 -o inline:'xxx\n' -e empty ${TEST_SH} -c ' + : <<- in | case xxx + in + in xxx) echo xxx;; + esac' +} + atf_test_case vicious vicious_head() { atf_set "descr" "Tests for obscure and obnoxious uses of here docs" @@ -600,5 +629,6 @@ atf_init_test_cases() { atf_add_test_case nested # here docs inside here docs atf_add_test_case quoting # stuff quoted inside atf_add_test_case side_effects # here docs that modify environment + atf_add_test_case hard_cases # here doc bodies appearing mid command atf_add_test_case vicious # evil test from the austin-l list... }