108 tearDown |
108 tearDown |
109 self targetFile delete. |
109 self targetFile delete. |
110 ! ! |
110 ! ! |
111 |
111 |
112 !OperatingSystemTest methodsFor:'tests'! |
112 !OperatingSystemTest methodsFor:'tests'! |
|
113 |
|
114 test01_environmentVariables |
|
115 |batchFile output |
|
116 expected50 expected101 expected203 expected407 expected815 expected1631 expected3263| |
|
117 |
|
118 self |
|
119 skipIf:(OperatingSystem isMSWINDOWSlike not) |
|
120 description:'This test is only for the Windows platform'. |
|
121 |
|
122 "/ reading env-var |
|
123 |
|
124 batchFile := 'test.bat' asFilename. |
|
125 batchFile contents:'@set FOO=hello |
|
126 @stx --eval "Stdout nextPutAll:(OperatingSystem getEnvironment:''FOO'') " |
|
127 '. |
|
128 |
|
129 output := |
|
130 String streamContents:[:out | |
|
131 OperatingSystem executeCommand:'test.bat' outputTo:out. |
|
132 ]. |
|
133 |
|
134 self assert:(output = 'hello'). |
|
135 |
|
136 "/ reading a longer env-var (50 chars) |
|
137 |
|
138 batchFile := 'test.bat' asFilename. |
|
139 batchFile contents:'@set FOO=12345678901234567890123456789012345678901234567890 |
|
140 @stx --eval "Stdout nextPutAll:(OperatingSystem getEnvironment:''FOO'') " |
|
141 '. |
|
142 |
|
143 output := |
|
144 String streamContents:[:out | |
|
145 OperatingSystem executeCommand:'test.bat' outputTo:out. |
|
146 ]. |
|
147 |
|
148 self assert:(output = '12345678901234567890123456789012345678901234567890'). |
|
149 |
|
150 "/ reading a longer env-var (1631 chars) |
|
151 |
|
152 batchFile := 'test.bat' asFilename. |
|
153 batchFile contents:'@set V50=12345678901234567890123456789012345678901234567890 |
|
154 @set V101=%V50%;%V50% |
|
155 @set V203=%V101%;%V101% |
|
156 @set V407=%V203%;%V203% |
|
157 @set V815=%V407%;%V407% |
|
158 @set V1631=%V815%;%V815% |
|
159 @stx --eval "Stdout nextPutAll:(OperatingSystem getEnvironment:''V1631'') " |
|
160 '. |
|
161 |
|
162 output := |
|
163 String streamContents:[:out | |
|
164 OperatingSystem executeCommand:'test.bat' outputTo:out. |
|
165 ]. |
|
166 |
|
167 expected50 := '12345678901234567890123456789012345678901234567890'. |
|
168 expected101 := expected50,';',expected50. |
|
169 expected203 := expected101,';',expected101. |
|
170 expected407 := expected203,';',expected203. |
|
171 expected815 := expected407,';',expected407. |
|
172 expected1631 := expected815,';',expected815. |
|
173 |
|
174 self assert:(output = expected1631). |
|
175 |
|
176 "/ reading a longer env-var (1631 chars) |
|
177 |
|
178 batchFile := 'test.bat' asFilename. |
|
179 batchFile contents:'@set V50=12345678901234567890123456789012345678901234567890 |
|
180 @set V101=%V50%;%V50% |
|
181 @set V203=%V101%;%V101% |
|
182 @set V407=%V203%;%V203% |
|
183 @set V815=%V407%;%V407% |
|
184 @set V1631=%V815%;%V815% |
|
185 @set V3263=%V1631%;%V1631% |
|
186 @stx --eval "Stdout nextPutAll:(OperatingSystem getEnvironment:''V3263'') " |
|
187 '. |
|
188 |
|
189 output := |
|
190 String streamContents:[:out | |
|
191 OperatingSystem executeCommand:'test.bat' outputTo:out. |
|
192 ]. |
|
193 |
|
194 expected50 := '12345678901234567890123456789012345678901234567890'. |
|
195 expected101 := expected50,';',expected50. |
|
196 expected203 := expected101,';',expected101. |
|
197 expected407 := expected203,';',expected203. |
|
198 expected815 := expected407,';',expected407. |
|
199 expected1631 := expected815,';',expected815. |
|
200 expected3263 := expected1631,';',expected1631. |
|
201 |
|
202 self assert:(output = expected3263). |
|
203 |
|
204 " |
|
205 self new test01_environmentVariables |
|
206 " |
|
207 ! |
113 |
208 |
114 testActorStream |
209 testActorStream |
115 OperatingSystem isMSDOSlike ifTrue:[ |
210 OperatingSystem isMSDOSlike ifTrue:[ |
116 self helperActorStreamWithCommand:'dir'. |
211 self helperActorStreamWithCommand:'dir'. |
117 ^ self |
212 ^ self |