1 # $Id: modword,v 1.1 2003/09/27 21:29:37 sjg Exp $
3 # Test behaviour of new :[] modifier
5 all: mod-squarebrackets mod-S-W mod-C-W mod-tW-tw
9 LONGLIST= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
11 EMPTY= # the space should be ignored
12 ESCAPEDSPACE=\ # escaped space before the '#'
13 REALLYSPACE:=${EMPTY:C/^/ /W}
21 mod-squarebrackets: mod-squarebrackets-0-star-at \
22 mod-squarebrackets-hash \
23 mod-squarebrackets-n \
24 mod-squarebrackets-start-end \
25 mod-squarebrackets-nested
27 mod-squarebrackets-0-star-at:
28 @echo 'LIST:[]="${LIST:[]}" is an error'
29 @echo 'LIST:[0]="${LIST:[0]}"'
30 @echo 'LIST:[0x0]="${LIST:[0x0]}"'
31 @echo 'LIST:[000]="${LIST:[000]}"'
32 @echo 'LIST:[*]="${LIST:[*]}"'
33 @echo 'LIST:[@]="${LIST:[@]}"'
34 @echo 'LIST:[0]:C/ /,/="${LIST:[0]:C/ /,/}"'
35 @echo 'LIST:[0]:C/ /,/g="${LIST:[0]:C/ /,/g}"'
36 @echo 'LIST:[0]:C/ /,/1g="${LIST:[0]:C/ /,/1g}"'
37 @echo 'LIST:[*]:C/ /,/="${LIST:[*]:C/ /,/}"'
38 @echo 'LIST:[*]:C/ /,/g="${LIST:[*]:C/ /,/g}"'
39 @echo 'LIST:[*]:C/ /,/1g="${LIST:[*]:C/ /,/1g}"'
40 @echo 'LIST:[@]:C/ /,/="${LIST:[@]:C/ /,/}"'
41 @echo 'LIST:[@]:C/ /,/g="${LIST:[@]:C/ /,/g}"'
42 @echo 'LIST:[@]:C/ /,/1g="${LIST:[@]:C/ /,/1g}"'
43 @echo 'LIST:[@]:[0]:C/ /,/="${LIST:[@]:[0]:C/ /,/}"'
44 @echo 'LIST:[0]:[@]:C/ /,/="${LIST:[0]:[@]:C/ /,/}"'
45 @echo 'LIST:[@]:[*]:C/ /,/="${LIST:[@]:[*]:C/ /,/}"'
46 @echo 'LIST:[*]:[@]:C/ /,/="${LIST:[*]:[@]:C/ /,/}"'
48 mod-squarebrackets-hash:
49 @echo 'EMPTY="${EMPTY}"'
50 @echo 'EMPTY:[#]="${EMPTY:[#]}" == 1 ?'
51 @echo 'ESCAPEDSPACE="${ESCAPEDSPACE}"'
52 @echo 'ESCAPEDSPACE:[#]="${ESCAPEDSPACE:[#]}" == 1 ?'
53 @echo 'REALLYSPACE="${REALLYSPACE}"'
54 @echo 'REALLYSPACE:[#]="${REALLYSPACE:[#]}" == 1 ?'
55 @echo 'LIST:[#]="${LIST:[#]}"'
56 @echo 'LIST:[0]:[#]="${LIST:[0]:[#]}" == 1 ?'
57 @echo 'LIST:[*]:[#]="${LIST:[*]:[#]}" == 1 ?'
58 @echo 'LIST:[@]:[#]="${LIST:[@]:[#]}"'
59 @echo 'LIST:[1]:[#]="${LIST:[1]:[#]}"'
60 @echo 'LIST:[1..3]:[#]="${LIST:[1..3]:[#]}"'
63 @echo 'EMPTY:[1]="${EMPTY:[1]}"'
64 @echo 'ESCAPEDSPACE="${ESCAPEDSPACE}"'
65 @echo 'ESCAPEDSPACE:[1]="${ESCAPEDSPACE:[1]}"'
66 @echo 'REALLYSPACE="${REALLYSPACE}"'
67 @echo 'REALLYSPACE:[1]="${REALLYSPACE:[1]}" == "" ?'
68 @echo 'REALLYSPACE:[*]:[1]="${REALLYSPACE:[*]:[1]}" == " " ?'
69 @echo 'LIST:[1]="${LIST:[1]}"'
70 @echo 'LIST:[1.]="${LIST:[1.]}" is an error'
71 @echo 'LIST:[1].="${LIST:[1].}" is an error'
72 @echo 'LIST:[2]="${LIST:[2]}"'
73 @echo 'LIST:[6]="${LIST:[6]}"'
74 @echo 'LIST:[7]="${LIST:[7]}"'
75 @echo 'LIST:[999]="${LIST:[999]}"'
76 @echo 'LIST:[-]="${LIST:[-]}" is an error'
77 @echo 'LIST:[--]="${LIST:[--]}" is an error'
78 @echo 'LIST:[-1]="${LIST:[-1]}"'
79 @echo 'LIST:[-2]="${LIST:[-2]}"'
80 @echo 'LIST:[-6]="${LIST:[-6]}"'
81 @echo 'LIST:[-7]="${LIST:[-7]}"'
82 @echo 'LIST:[-999]="${LIST:[-999]}"'
83 @echo 'LONGLIST:[17]="${LONGLIST:[17]}"'
84 @echo 'LONGLIST:[0x11]="${LONGLIST:[0x11]}"'
85 @echo 'LONGLIST:[021]="${LONGLIST:[021]}"'
86 @echo 'LIST:[0]:[1]="${LIST:[0]:[1]}"'
87 @echo 'LIST:[*]:[1]="${LIST:[*]:[1]}"'
88 @echo 'LIST:[@]:[1]="${LIST:[@]:[1]}"'
89 @echo 'LIST:[0]:[2]="${LIST:[0]:[2]}"'
90 @echo 'LIST:[*]:[2]="${LIST:[*]:[2]}"'
91 @echo 'LIST:[@]:[2]="${LIST:[@]:[2]}"'
92 @echo 'LIST:[*]:C/ /,/:[2]="${LIST:[*]:C/ /,/:[2]}"'
93 @echo 'LIST:[*]:C/ /,/:[*]:[2]="${LIST:[*]:C/ /,/:[*]:[2]}"'
94 @echo 'LIST:[*]:C/ /,/:[@]:[2]="${LIST:[*]:C/ /,/:[@]:[2]}"'
96 mod-squarebrackets-start-end:
97 @echo 'LIST:[1.]="${LIST:[1.]}" is an error'
98 @echo 'LIST:[1..]="${LIST:[1..]}" is an error'
99 @echo 'LIST:[1..1]="${LIST:[1..1]}"'
100 @echo 'LIST:[1..1.]="${LIST:[1..1.]}" is an error'
101 @echo 'LIST:[1..2]="${LIST:[1..2]}"'
102 @echo 'LIST:[2..1]="${LIST:[2..1]}"'
103 @echo 'LIST:[3..-2]="${LIST:[3..-2]}"'
104 @echo 'LIST:[-4..4]="${LIST:[-4..4]}"'
105 @echo 'LIST:[0..1]="${LIST:[0..1]}" is an error'
106 @echo 'LIST:[-1..0]="${LIST:[-1..0]}" is an error'
107 @echo 'LIST:[-1..1]="${LIST:[-1..1]}"'
108 @echo 'LIST:[0..0]="${LIST:[0..0]}"'
109 @echo 'LIST:[3..99]="${LIST:[3..99]}"'
110 @echo 'LIST:[-3..-99]="${LIST:[-3..-99]}"'
111 @echo 'LIST:[-99..-3]="${LIST:[-99..-3]}"'
113 mod-squarebrackets-nested:
114 @echo 'HASH="${HASH}" == "#" ?'
115 @echo 'LIST:[$${HASH}]="${LIST:[${HASH}]}"'
116 @echo 'LIST:[$${ZERO}]="${LIST:[${ZERO}]}"'
117 @echo 'LIST:[$${ZERO}x$${ONE}]="${LIST:[${ZERO}x${ONE}]}"'
118 @echo 'LIST:[$${ONE}]="${LIST:[${ONE}]}"'
119 @echo 'LIST:[$${MINUSONE}]="${LIST:[${MINUSONE}]}"'
120 @echo 'LIST:[$${STAR}]="${LIST:[${STAR}]}"'
121 @echo 'LIST:[$${AT}]="${LIST:[${AT}]}"'
122 @echo 'LIST:[$${EMPTY}]="${LIST:[${EMPTY}]}" is an error'
123 @echo 'LIST:[$${LONGLIST:[21]:S/2//}]="${LIST:[${LONGLIST:[21]:S/2//}]}"'
124 @echo 'LIST:[$${LIST:[#]}]="${LIST:[${LIST:[#]}]}"'
125 @echo 'LIST:[$${LIST:[$${HASH}]}]="${LIST:[${LIST:[${HASH}]}]}"'
128 @echo 'LIST:C/ /,/="${LIST:C/ /,/}"'
129 @echo 'LIST:C/ /,/W="${LIST:C/ /,/W}"'
130 @echo 'LIST:C/ /,/gW="${LIST:C/ /,/gW}"'
131 @echo 'EMPTY:C/^/,/="${EMPTY:C/^/,/}"'
132 @echo 'EMPTY:C/^/,/W="${EMPTY:C/^/,/W}"'
135 @echo 'LIST:S/ /,/="${LIST:S/ /,/}"'
136 @echo 'LIST:S/ /,/W="${LIST:S/ /,/W}"'
137 @echo 'LIST:S/ /,/gW="${LIST:S/ /,/gW}"'
138 @echo 'EMPTY:S/^/,/="${EMPTY:S/^/,/}"'
139 @echo 'EMPTY:S/^/,/W="${EMPTY:S/^/,/W}"'
142 @echo 'LIST:tW="${LIST:tW}"'
143 @echo 'LIST:tw="${LIST:tw}"'
144 @echo 'LIST:tW:C/ /,/="${LIST:tW:C/ /,/}"'
145 @echo 'LIST:tW:C/ /,/g="${LIST:tW:C/ /,/g}"'
146 @echo 'LIST:tW:C/ /,/1g="${LIST:tW:C/ /,/1g}"'
147 @echo 'LIST:tw:C/ /,/="${LIST:tw:C/ /,/}"'
148 @echo 'LIST:tw:C/ /,/g="${LIST:tw:C/ /,/g}"'
149 @echo 'LIST:tw:C/ /,/1g="${LIST:tw:C/ /,/1g}"'
150 @echo 'LIST:tw:tW:C/ /,/="${LIST:tw:tW:C/ /,/}"'
151 @echo 'LIST:tW:tw:C/ /,/="${LIST:tW:tw:C/ /,/}"'