1 # This program is free software: you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation, either version 3 of the License, or
4 # (at your option) any later version.
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU General Public License for more details.
11 # You should have received a copy of the GNU General Public License
12 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 bashname=bash${BASH_VERSION%%.*}
17 # tests for Posix grammar special cases
19 # Posix grammar rule 5
20 ${THIS_SH} -c 'for invalid-name in a b c; do echo error; done' $bashname
22 # Posix grammar rule 6: third word in FOR or SELECT
23 for i; do echo; done; echo in
24 for i; do echo in; done
25 for i do echo in; done
27 select i; do echo; done; echo in
28 select i; do echo in; done; echo in
29 select i do echo in; done; echo in
31 # Posix grammar rule 4: when PATTERN == ESAC, return ESAC
32 ${THIS_SH} -c 'case x in esac) echo done; esac' $bashname
34 # Posix grammar rule 6: third word in CASE
35 ${THIS_SH} -c 'case in in in) echo in; esac;' $bashname
36 ${THIS_SH} -c 'case in do do) echo in; esac' $bashname
38 # Posix grammar rule 8: function NAME
39 ${THIS_SH} -o posix -c 'for()
44 for for in for; do echo in; echo done; done
46 ${THIS_SH} -c 'for (( i = 0; i < 5; i++ )) do : ; done' $bashname
47 ${THIS_SH} -c 'for (( i = 0; i < 5; i++ )) { : ; }' $bashname
49 # bug report: IN turning on unwanted alias expansion
50 ${THIS_SH} -o posix -c '
58 ${THIS_SH} -o posix -c '