Mercurial > vim
annotate runtime/syntax/testdir/input/sh_08.sh @ 32631:f8a2fc7d823f v9.0.1647
patch 9.0.1647: insufficient testing for syntax plugins
Commit: https://github.com/vim/vim/commit/1aa5f1c21fea60fe64cdcdf6990bf43ea5cc78a0
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jun 22 21:57:51 2023 +0100
patch 9.0.1647: insufficient testing for syntax plugins
Problem: Insufficient testing for syntax plugins.
Solution: Add shell file examples. (Charles Campbell) Create a messages
file for easier debugging and reporting the test results.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 22 Jun 2023 23:00:05 +0200 |
parents | |
children | 448aef880252 |
rev | line source |
---|---|
32631
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 #!/bin/ksh -p |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 # Note that this is special test file for ksh. sh is an extra file. |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 # Note too, that this file contains ONLY things which works for ksh BUT NOT |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 # for sh |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 # This all should be OK |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 # Several keywords without any quotes! |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 # Case 1a. Several Constants |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 [ -t 0 ] && date |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 Variable1=${VariableA:-This is a Text} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 Variable2=${VariableA:=This is a Text} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 Variable3=${VariableA:?This is a Text} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 echo "$Variable1" ; echo "$Variable2" ; echo "$Variable3" |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
16 |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 # Case 1b. Variable and Constant |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
18 [ -t 0 ] && echo "\n`date`" && unset VariableA |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
19 Variable1=${VariableA:-$HOME This is a Text} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
20 Variable2=${VariableA:=$HOME This is a Text} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 Variable3=${VariableA:?$HOME This is a Text} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 echo "$Variable1" ; echo "$Variable2" ; echo "$Variable3" |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 # Case 1c. Constant and Variable |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
25 [ -t 0 ] && echo "\n`date`" && unset VariableA |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
26 Variable1=${VariableA:-This is a Text in $HOME} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
27 Variable2=${VariableA:=This is a Text in $HOME} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
28 Variable3=${VariableA:+This is a Text in $HOME} #! :+ is bash-only, error here expected |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 Variable1=${VariableA:-This is a Text in $HOME too} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
30 Variable2=${VariableA:=This is a Text in $HOME too} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
31 Variable3=${VariableA:+This is a Text in $HOME too} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
32 echo "$Variable1" ; echo "$Variable2" ; echo "$Variable3" |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
33 |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
34 # Case 1d. More Variables and Constants. Starting with a Variable. |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
35 [ -t 0 ] && echo "\n`date`" && unset VariableA |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
36 Variable1=${VariableA:-$SHELL} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
37 Variable1=${VariableA:-$SHELL This is a Text in $HOME} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
38 Variable2=${VariableA:=$SHELL This is a Text in $HOME} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
39 Variable3=${VariableA:+$SHELL This is a Text in $HOME} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
40 echo "$Variable1" ; echo "$Variable2" ; echo "$Variable3" |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
41 |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
42 # Case 1e. More Constants and Variables. Starting with a Constant. |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
43 [ -t 0 ] && echo "\n`date`" && unset VariableA |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
44 Variable1=${VariableA:-"This is a Text in $HOME $SHELL"} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
45 Variable1=${VariableA:-This is a Text in $HOME $SHELL} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
46 Variable2=${VariableA:=This is a Text in $HOME $SHELL} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
47 Variable3=${VariableA:+This is a Text in $HOME $SHELL} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
48 echo "$Variable1" ; echo "$Variable2" ; echo "$Variable3" |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
49 |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
50 # Case 1x. The same with ':' |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
51 [ -t 0 ] && echo "\n`date`" && unset VariableA |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
52 : ${VariableA:-This is a Text} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
53 : ${VariableA:-$HOME This is a Text} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
54 : ${VariableA:-This is a Text in $HOME} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
55 : ${VariableA:-$SHELL This is a Text in $HOME} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
56 : ${VariableA:-This is a Text in $HOME $SHELL} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
57 |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
58 # Case 1y. The same with ':' and without the ':' in the parameter substitution |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
59 [ -t 0 ] && echo "\n`date`" && unset VariableA |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
60 : ${VariableA-This is a Text} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
61 : ${VariableA-$HOME This is a Text} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
62 : ${VariableA-This is a Text in $HOME} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
63 : ${VariableA-$SHELL This is a Text in $HOME} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
64 : ${VariableA-This is a Text in $HOME $SHELL} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
65 |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
66 ################################################################################ |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
67 # |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
68 # This are valid usages for ${Var:?} in ksh! |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
69 # |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
70 Variable4=${Variable4:?This is an Error Message} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
71 Variable4=${Variable4:?This is an Error Message from `date`} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
72 |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
73 : ${Variable4:?This is an Error Message} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
74 : ${Variable4:?This is an Error Message from `date`} |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
75 |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
76 exit $? |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
77 |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
78 # Michael Soulier |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
79 if [ $# -ne 1 ]; then |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
80 echo whatever |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
81 exit 1 |
f8a2fc7d823f
patch 9.0.1647: insufficient testing for syntax plugins
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
82 fi |