From 6c20c8ed2cb9ab69a1a57ccb2b9b79969a808321 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 17:38:56 +0200 Subject: Adding upstream version 5.2.15. Signed-off-by: Daniel Baumann --- tests/comsub-posix5.sub | 70 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 tests/comsub-posix5.sub (limited to 'tests/comsub-posix5.sub') diff --git a/tests/comsub-posix5.sub b/tests/comsub-posix5.sub new file mode 100644 index 0000000..f10e773 --- /dev/null +++ b/tests/comsub-posix5.sub @@ -0,0 +1,70 @@ +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +: ${THIS_SH:=./bash} + +# problems with recognzing `esac' after a right paren in a command substitution + +: $(case x in x) esac) +: $(case x in x) ;; x) esac) +# non-reserved word beginning with e +: $(case x in x) ;; x) echo ;; esac) +# reserved word beginning with e +: $(case x in x) ;; x) eval esac ;; esac) + +: $(case x in x ) esac) +: $(case x in x ) ;; x) esac) + +: $(case x in (x) esac) +: $(case x in (x) ;; (x) esac) +: $(case x in (x) ;; x) esac) +: $(case x in (x) (echo a) esac) + +: $(case x in (x) (echo esac) esac) +: $(case x in x) (echo esac) esac) + +# these errors should be caught sooner +${THIS_SH} -c ': $(case x in x) ;; x) done esac)' bash +${THIS_SH} -c ': $(case x in x) ;; x) done ;; esac)' bash +${THIS_SH} -c ': $(case x in x) (esac) esac)' bash + +# these are not errors +: $(case x in x) ;; x) eval done ;; esac) + +# these are just ridiculous +: $(case x in (x) a() { echo a; } esac) +: $(case x in (x) if :; then echo a; fi esac) +: $(case x in (x) { echo a; } esac) +: $(case x in (x) while false; do echo a; done esac) +: $(case x in (x) case y in (y) echo a;; esac esac) +: $(case x in (x) case y in (y) echo a;; esac ;; (y) foo ;; esac) + +: $(case x in x) a() { echo a; } esac) +: $(case x in x) if :; then echo a; fi esac) +: $(case x in x) { echo a; } esac) +: $(case x in x) while false; do echo a; done esac) +: $(case x in x) case y in (y) echo a;; esac esac) +: $(case x in x) case y in (y) echo a;; esac ;; y) foo ;; esac) +: $(case x in x) case y in y) echo a;; esac ;; y) foo ;; esac) + +: $(case ni in esac) +: $(case in in esac) + +: $(case x in in|esac) foo;; esac) +: $(case esac in (esac) echo esac;; esac) +: $(case k in else|done|time|esac) for f in 1 2 3 ; do :; done esac) + +# this is an error +${THIS_SH} -c ': $(case x in esac|in) foo;; esac)' bash + +${THIS_SH} -c ': $(case x in x) ;; x) done)' bash -- cgit v1.2.3