Source-Changes-HG archive

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

[src/trunk]: src/tests/bin/sh One more weird test of parsing (and correctly u...



details:   https://anonhg.NetBSD.org/src/rev/d4487afae8c0
branches:  trunk
changeset: 824337:d4487afae8c0
user:      kre <kre%NetBSD.org@localhost>
date:      Fri Jun 02 01:45:06 2017 +0000

description:
One more weird test of parsing (and correctly understanding) words
whose meaning is defined entirely by context.

For those who read commit messages, and want a (small) challenge,
work out where (and what) to insert as punctuation/operator chars
in the following to produce 3 ines of output, and what those will be:

        for in in in do in do case in in in echo do do echo in esac done

(There are no comments, quotes of any kind, or any kind of sub-shell,
including cmd substitutions)  With correct non alpha-numeric chars added,
it works.

diffstat:

 tests/bin/sh/t_syntax.sh |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (18 lines):

diff -r f59713b0e10b -r d4487afae8c0 tests/bin/sh/t_syntax.sh
--- a/tests/bin/sh/t_syntax.sh  Fri Jun 02 01:38:44 2017 +0000
+++ b/tests/bin/sh/t_syntax.sh  Fri Jun 02 01:45:06 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_syntax.sh,v 1.1 2017/05/20 16:35:55 kre Exp $
+# $NetBSD: t_syntax.sh,v 1.2 2017/06/02 01:45:06 kre Exp $
 #
 # Copyright (c) 2017 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -632,6 +632,8 @@
                'for for in do;do : ;done'
        atf_check -s exit:0 -o empty -e empty ${TEST_SH} -c \
                'for in in in;do : ; done'
+       atf_check -s exit:0 -o 'inline:do\nin\ndo\n' -e empty ${TEST_SH} -c \
+   'for in in in do in;do case $in in in)echo do;;do)echo in;;esac; done'
        atf_check -s exit:0 -o empty -e empty ${TEST_SH} -c \
                'for in in for;do : ; done'
        atf_check -s exit:0 -o empty -e empty ${TEST_SH} -c \



Home | Main Index | Thread Index | Old Index