blob: 6b9b12d30c4e78bb64a413e68dd41b132c504633 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
# Test various shell options.
# Interactive options not tested here:
# ALWAYS_LAST_PROMPT
# ALWAYS_TO_END
# APPEND_HISTORY (history not maintained)
# AUTO_LIST
# AUTO_MENU
# AUTO_NAME_DIRS (named directory table not maintained)
# AUTO_PARAM_KEYS
# AUTO_PARAM_SLASH
# AUTO_REMOVE_SLASH
# AUTO_RESUME
# BANG_HIST
# BASH_AUTO_LIST
# BEEP (!)
# BG_NICE
# CHECK_JOBS
# COMPLETE_ALIASES
# COMPLETE_IN_WORD
# CORRECT
# CORRECT_ALL
# CSH_JUNKIE_HISTORY
# The following require SHINSTDIN and are not (yet) tested:
# AUTO_CD (why?)
%prep
mkdir options.tmp && cd options.tmp
mkdir tmpcd
touch tmpfile1 tmpfile2
mydir=$PWD
%test
alias echo='print foo'
unsetopt aliases
# use eval else aliases are all parsed at start
eval echo bar
setopt aliases
eval echo bar
unalias echo
0:ALIASES option
>bar
>foo bar
setopt allexport
testpm1=exported
unsetopt allexport
testpm2=unexported
print ${(t)testpm1}
print ${(t)testpm2}
0:ALL_EXPORT option
>scalar-export
>scalar
# Count the number of directories on the stack. Don't care what they are.
dircount() { dirs -v | tail -1 | awk '{ print $1 + 1}'; }
unsetopt autopushd
cd tmpcd
dircount
cd ..
setopt autopushd
cd tmpcd
dircount
cd ..
unsetopt autopushd
0:AUTO_PUSHD option
>1
>2
unsetopt badpattern
print [a
setopt badpattern
print [b
1:BAD_PATTERN option
>[a
?ZTST_execchunk:2: bad pattern: [b
unsetopt bareglobqual nomatch
print *(.)
setopt bareglobqual nomatch
print *(.)
0:BARE_GLOB_QUAL option
>*(.)
>tmpfile1 tmpfile2
setopt braceccl
print {abcd}
unsetopt braceccl
print {abcd}
0:BRACE_CCL option
>a b c d
>{abcd}
setopt bsdecho
echo "histon\nimpington"
echo -e "girton\ncottenham"
unsetopt bsdecho
echo "newnham\ncomberton"
0:BSD_ECHO option
>histon\nimpington
>girton
>cottenham
>newnham
>comberton
unsetopt c_bases
print $(( [#16]15 ))
print $(( [#8]9 ))
setopt c_bases
print $(( [#16]31 ))
print $(( [#8]17 ))
setopt octal_zeroes
print $(( [#8]19 ))
unsetopt c_bases octal_zeroes
0:C_BASES option
>16#F
>8#11
>0x1F
>8#21
>023
setopt cdablevars
# only absolute paths are eligible for ~-expansion
cdablevar1=tmpcd
(cd cdablevar1)
cdablevar2=$PWD/tmpcd
cd cdablevar2
cd ..
print back in ${PWD:t}
unsetopt cdablevars
cd cdablevar2
1q:CDABLE_VARS option
>`print -P '%~'`/tmpcd
>back in options.tmp
?ZTST_execchunk:cd:2: no such file or directory: cdablevar1
?ZTST_execchunk:cd:2: no such file or directory: cdablevar2
# CHASE_DOTS should go with CHASE_LINKS in B01cd.ztst
# which saves me having to write it here.
setopt noclobber
rm -f foo1 bar1 rod1
echo waterbeach >foo1
(echo landbeach >foo1)
cat foo1
(echo lode >>bar1)
[[ -f bar1 ]] && print That shouldn\'t be there.
echo denny >rod1
echo wicken >>rod1
cat rod1
unsetopt noclobber
rm -f foo2 bar2 rod2
echo ely >foo2
echo march >foo2
cat foo2
echo wimpole >>bar2
cat bar2
echo royston >rod2
echo foxton >>rod2
cat rod2
0:CLOBBER option
>waterbeach
>denny
>wicken
>march
>wimpole
>royston
>foxton
?ZTST_execchunk:2: file exists: foo1
?ZTST_execchunk:2: no such file or directory: bar1
setopt cshjunkieloops
eval 'for f in swaffham bulbeck; print $f; end'
print next one should fail >&2
unsetopt cshjunkieloops
eval 'for f in chesterton arbury; print $f; end'
1:CSH_JUNKIE_LOOPS option (for loop)
>swaffham
>bulbeck
?next one should fail
?ZTST_execchunk:-1: parse error near `end'
|