win32-dir 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +62 -59
- data/README +265 -265
- data/Rakefile +32 -32
- data/lib/win32/dir/constants.rb +18 -18
- data/lib/win32/dir/functions.rb +35 -35
- data/lib/win32/dir/structs.rb +29 -29
- data/lib/win32/dir.rb +419 -331
- data/test/test_win32_dir.rb +397 -385
- data/win32-dir.gemspec +28 -28
- metadata +2 -2
data/test/test_win32_dir.rb
CHANGED
@@ -1,385 +1,397 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
###########################################################################
|
3
|
-
# test_win32_dir.rb
|
4
|
-
#
|
5
|
-
# Test suite for the win32-dir library. You should run this test case
|
6
|
-
# via the 'rake test' task.
|
7
|
-
###########################################################################
|
8
|
-
require 'test-unit'
|
9
|
-
require 'win32/dir'
|
10
|
-
require 'tmpdir'
|
11
|
-
require 'fileutils'
|
12
|
-
|
13
|
-
class TC_Win32_Dir < Test::Unit::TestCase
|
14
|
-
def self.startup
|
15
|
-
@@java = RUBY_PLATFORM == 'java'
|
16
|
-
@@temp = Dir.tmpdir
|
17
|
-
@@from = File.join(@@temp, "test_from_directory")
|
18
|
-
Dir.mkdir(@@from)
|
19
|
-
end
|
20
|
-
|
21
|
-
def setup
|
22
|
-
@ascii_to = File.join(@@temp, "test_to_directory")
|
23
|
-
@unicode_to = File.join(@@temp, "Ελλάσ")
|
24
|
-
@test_file = File.join(@@from, "test.txt")
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
assert_equal('0.4.
|
29
|
-
end
|
30
|
-
|
31
|
-
test 'glob handles backslashes' do
|
32
|
-
pattern = "C:\\Program Files\\Common Files\\System\\*.dll"
|
33
|
-
assert_nothing_raised{ Dir.glob(pattern) }
|
34
|
-
assert_true(Dir.glob(pattern).size > 0)
|
35
|
-
end
|
36
|
-
|
37
|
-
test 'glob still observes flags' do
|
38
|
-
assert_nothing_raised{ Dir.glob('*', File::FNM_DOTMATCH ) }
|
39
|
-
assert_true(Dir.glob('*', File::FNM_DOTMATCH).include?('.'))
|
40
|
-
end
|
41
|
-
|
42
|
-
test 'glob still honors block' do
|
43
|
-
array = []
|
44
|
-
assert_nothing_raised{ Dir.glob('*', File::FNM_DOTMATCH ){ |m| array << m } }
|
45
|
-
assert_true(array.include?('.'))
|
46
|
-
end
|
47
|
-
|
48
|
-
test 'ref handles backslashes' do
|
49
|
-
pattern = "C:\\Program Files\\Common Files\\System\\*.dll"
|
50
|
-
assert_nothing_raised{ Dir[pattern] }
|
51
|
-
assert_true(Dir[pattern].size > 0)
|
52
|
-
end
|
53
|
-
|
54
|
-
test "create_junction basic functionality" do
|
55
|
-
assert_respond_to(Dir, :create_junction)
|
56
|
-
end
|
57
|
-
|
58
|
-
test "create_junction works as expected with ascii characters" do
|
59
|
-
assert_nothing_raised{ Dir.create_junction(@ascii_to, @@from) }
|
60
|
-
assert_true(File.exists?(@ascii_to))
|
61
|
-
File.open(@test_file, 'w'){ |fh| fh.puts "Hello World" }
|
62
|
-
assert_equal(Dir.entries(@@from), Dir.entries(@ascii_to))
|
63
|
-
end
|
64
|
-
|
65
|
-
test "create_junction works as expected with unicode characters" do
|
66
|
-
assert_nothing_raised{ Dir.create_junction(@unicode_to, @@from) }
|
67
|
-
assert_true(File.exists?(@unicode_to))
|
68
|
-
File.open(@test_file, 'w'){ |fh| fh.puts "Hello World" }
|
69
|
-
assert_equal(Dir.entries(@@from), Dir.entries(@unicode_to))
|
70
|
-
end
|
71
|
-
|
72
|
-
test "
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
end
|
83
|
-
|
84
|
-
test "
|
85
|
-
assert_respond_to(Dir, :
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
assert_respond_to(Dir, :
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
Dir.
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
Dir.
|
106
|
-
|
107
|
-
end
|
108
|
-
|
109
|
-
test "pwd
|
110
|
-
omit_if(@@java)
|
111
|
-
Dir.chdir("C:\\
|
112
|
-
assert_equal("C:\\Program Files", Dir.pwd)
|
113
|
-
end
|
114
|
-
|
115
|
-
test "pwd
|
116
|
-
omit_if(@@java)
|
117
|
-
Dir.chdir("C
|
118
|
-
assert_equal("C:\\Program Files", Dir.pwd)
|
119
|
-
end
|
120
|
-
|
121
|
-
test "pwd
|
122
|
-
omit_if(@@java)
|
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
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
###########################################################################
|
3
|
+
# test_win32_dir.rb
|
4
|
+
#
|
5
|
+
# Test suite for the win32-dir library. You should run this test case
|
6
|
+
# via the 'rake test' task.
|
7
|
+
###########################################################################
|
8
|
+
require 'test-unit'
|
9
|
+
require 'win32/dir'
|
10
|
+
require 'tmpdir'
|
11
|
+
require 'fileutils'
|
12
|
+
|
13
|
+
class TC_Win32_Dir < Test::Unit::TestCase
|
14
|
+
def self.startup
|
15
|
+
@@java = RUBY_PLATFORM == 'java'
|
16
|
+
@@temp = Dir.tmpdir
|
17
|
+
@@from = File.join(@@temp, "test_from_directory")
|
18
|
+
Dir.mkdir(@@from)
|
19
|
+
end
|
20
|
+
|
21
|
+
def setup
|
22
|
+
@ascii_to = File.join(@@temp, "test_to_directory")
|
23
|
+
@unicode_to = File.join(@@temp, "Ελλάσ")
|
24
|
+
@test_file = File.join(@@from, "test.txt")
|
25
|
+
end
|
26
|
+
|
27
|
+
test "version number is set to expected value" do
|
28
|
+
assert_equal('0.4.1', Dir::VERSION)
|
29
|
+
end
|
30
|
+
|
31
|
+
test 'glob handles backslashes' do
|
32
|
+
pattern = "C:\\Program Files\\Common Files\\System\\*.dll"
|
33
|
+
assert_nothing_raised{ Dir.glob(pattern) }
|
34
|
+
assert_true(Dir.glob(pattern).size > 0)
|
35
|
+
end
|
36
|
+
|
37
|
+
test 'glob still observes flags' do
|
38
|
+
assert_nothing_raised{ Dir.glob('*', File::FNM_DOTMATCH ) }
|
39
|
+
assert_true(Dir.glob('*', File::FNM_DOTMATCH).include?('.'))
|
40
|
+
end
|
41
|
+
|
42
|
+
test 'glob still honors block' do
|
43
|
+
array = []
|
44
|
+
assert_nothing_raised{ Dir.glob('*', File::FNM_DOTMATCH ){ |m| array << m } }
|
45
|
+
assert_true(array.include?('.'))
|
46
|
+
end
|
47
|
+
|
48
|
+
test 'ref handles backslashes' do
|
49
|
+
pattern = "C:\\Program Files\\Common Files\\System\\*.dll"
|
50
|
+
assert_nothing_raised{ Dir[pattern] }
|
51
|
+
assert_true(Dir[pattern].size > 0)
|
52
|
+
end
|
53
|
+
|
54
|
+
test "create_junction basic functionality" do
|
55
|
+
assert_respond_to(Dir, :create_junction)
|
56
|
+
end
|
57
|
+
|
58
|
+
test "create_junction works as expected with ascii characters" do
|
59
|
+
assert_nothing_raised{ Dir.create_junction(@ascii_to, @@from) }
|
60
|
+
assert_true(File.exists?(@ascii_to))
|
61
|
+
File.open(@test_file, 'w'){ |fh| fh.puts "Hello World" }
|
62
|
+
assert_equal(Dir.entries(@@from), Dir.entries(@ascii_to))
|
63
|
+
end
|
64
|
+
|
65
|
+
test "create_junction works as expected with unicode characters" do
|
66
|
+
assert_nothing_raised{ Dir.create_junction(@unicode_to, @@from) }
|
67
|
+
assert_true(File.exists?(@unicode_to))
|
68
|
+
File.open(@test_file, 'w'){ |fh| fh.puts "Hello World" }
|
69
|
+
assert_equal(Dir.entries(@@from), Dir.entries(@unicode_to))
|
70
|
+
end
|
71
|
+
|
72
|
+
test "read_junction works as expected with ascii characters" do
|
73
|
+
assert_nothing_raised{ Dir.create_junction(@ascii_to, @@from) }
|
74
|
+
assert_true(File.exists?(@ascii_to))
|
75
|
+
assert_equal(Dir.read_junction(@ascii_to), @@from.bytes.to_a.pack('C*').encode("UTF-16LE"))
|
76
|
+
end
|
77
|
+
|
78
|
+
test "read_junction works as expected with unicode characters" do
|
79
|
+
assert_nothing_raised{ Dir.create_junction(@unicode_to, @@from) }
|
80
|
+
assert_true(File.exists?(@unicode_to))
|
81
|
+
assert_equal(Dir.read_junction(@unicode_to), @@from.bytes.to_a.pack('C*').encode("UTF-16LE"))
|
82
|
+
end
|
83
|
+
|
84
|
+
test "junction? method returns boolean value" do
|
85
|
+
assert_respond_to(Dir, :junction?)
|
86
|
+
assert_nothing_raised{ Dir.create_junction(@ascii_to, @@from) }
|
87
|
+
assert_false(Dir.junction?(@@from))
|
88
|
+
assert_true(Dir.junction?(@ascii_to))
|
89
|
+
end
|
90
|
+
|
91
|
+
test "reparse_dir? is an aliase for junction?" do
|
92
|
+
assert_respond_to(Dir, :reparse_dir?)
|
93
|
+
assert_true(Dir.method(:reparse_dir?) == Dir.method(:junction?))
|
94
|
+
end
|
95
|
+
|
96
|
+
test "empty? method returns expected result" do
|
97
|
+
assert_respond_to(Dir, :empty?)
|
98
|
+
assert_false(Dir.empty?("C:\\")) # One would think
|
99
|
+
assert_true(Dir.empty?(@@from))
|
100
|
+
end
|
101
|
+
|
102
|
+
test "pwd basic functionality" do
|
103
|
+
omit_if(@@java)
|
104
|
+
assert_respond_to(Dir, :pwd)
|
105
|
+
assert_nothing_raised{ Dir.pwd }
|
106
|
+
assert_kind_of(String, Dir.pwd)
|
107
|
+
end
|
108
|
+
|
109
|
+
test "pwd returns full path even if short path was just used" do
|
110
|
+
omit_if(@@java)
|
111
|
+
Dir.chdir("C:\\Progra~1")
|
112
|
+
assert_equal("C:\\Program Files", Dir.pwd)
|
113
|
+
end
|
114
|
+
|
115
|
+
test "pwd returns full path if long path was just used" do
|
116
|
+
omit_if(@@java)
|
117
|
+
Dir.chdir("C:\\Program Files")
|
118
|
+
assert_equal("C:\\Program Files", Dir.pwd)
|
119
|
+
end
|
120
|
+
|
121
|
+
test "pwd uses standard case conventions" do
|
122
|
+
omit_if(@@java)
|
123
|
+
Dir.chdir("C:\\PROGRAM FILES")
|
124
|
+
assert_equal("C:\\Program Files", Dir.pwd)
|
125
|
+
end
|
126
|
+
|
127
|
+
test "pwd converts forward slashes to backslashes" do
|
128
|
+
omit_if(@@java)
|
129
|
+
Dir.chdir("C:/Program Files")
|
130
|
+
assert_equal("C:\\Program Files", Dir.pwd)
|
131
|
+
end
|
132
|
+
|
133
|
+
test "pwd and getwd are aliases" do
|
134
|
+
omit_if(@@java)
|
135
|
+
assert_true(Dir.method(:getwd) == Dir.method(:pwd))
|
136
|
+
end
|
137
|
+
|
138
|
+
test "admintools constant is set" do
|
139
|
+
assert_not_nil(Dir::ADMINTOOLS)
|
140
|
+
assert_kind_of(String, Dir::ADMINTOOLS)
|
141
|
+
end
|
142
|
+
|
143
|
+
test "altstartup constant is set" do
|
144
|
+
assert_not_nil(Dir::ALTSTARTUP)
|
145
|
+
assert_kind_of(String, Dir::ALTSTARTUP)
|
146
|
+
end
|
147
|
+
|
148
|
+
test "appdata constant is set" do
|
149
|
+
assert_not_nil(Dir::APPDATA)
|
150
|
+
assert_kind_of(String, Dir::APPDATA)
|
151
|
+
end
|
152
|
+
|
153
|
+
test "bitbucket constant is set" do
|
154
|
+
assert_not_nil(Dir::BITBUCKET)
|
155
|
+
assert_kind_of(String, Dir::BITBUCKET)
|
156
|
+
end
|
157
|
+
|
158
|
+
test "cdburn area is set" do
|
159
|
+
assert_not_nil(Dir::CDBURN_AREA)
|
160
|
+
assert_kind_of(String, Dir::CDBURN_AREA)
|
161
|
+
end
|
162
|
+
|
163
|
+
test "common admintools is set" do
|
164
|
+
assert_not_nil(Dir::COMMON_ADMINTOOLS)
|
165
|
+
assert_kind_of(String, Dir::COMMON_ADMINTOOLS)
|
166
|
+
end
|
167
|
+
|
168
|
+
test "common_altstartup constant is set" do
|
169
|
+
assert_not_nil(Dir::COMMON_ALTSTARTUP)
|
170
|
+
assert_kind_of(String, Dir::COMMON_ALTSTARTUP)
|
171
|
+
end
|
172
|
+
|
173
|
+
test "common_appdata constant is set" do
|
174
|
+
assert_not_nil(Dir::COMMON_APPDATA)
|
175
|
+
assert_kind_of(String, Dir::COMMON_APPDATA)
|
176
|
+
end
|
177
|
+
|
178
|
+
test "common desktopdirectory constant is set" do
|
179
|
+
assert_not_nil(Dir::COMMON_DESKTOPDIRECTORY)
|
180
|
+
assert_kind_of(String, Dir::COMMON_DESKTOPDIRECTORY)
|
181
|
+
end
|
182
|
+
|
183
|
+
test "common_documents constant is set" do
|
184
|
+
assert_not_nil(Dir::COMMON_DOCUMENTS)
|
185
|
+
assert_kind_of(String, Dir::COMMON_DOCUMENTS)
|
186
|
+
end
|
187
|
+
|
188
|
+
test "common_favorites constant is set" do
|
189
|
+
assert_not_nil(Dir::COMMON_FAVORITES)
|
190
|
+
assert_kind_of(String, Dir::COMMON_FAVORITES)
|
191
|
+
end
|
192
|
+
|
193
|
+
test "common_music constant is set" do
|
194
|
+
assert_not_nil(Dir::COMMON_MUSIC)
|
195
|
+
assert_kind_of(String, Dir::COMMON_MUSIC)
|
196
|
+
end
|
197
|
+
|
198
|
+
test "common_pictures constant is set" do
|
199
|
+
assert_not_nil(Dir::COMMON_PICTURES)
|
200
|
+
assert_kind_of(String, Dir::COMMON_PICTURES)
|
201
|
+
end
|
202
|
+
|
203
|
+
test "common_programs constant is set" do
|
204
|
+
assert_not_nil(Dir::COMMON_PROGRAMS)
|
205
|
+
assert_kind_of(String, Dir::COMMON_PROGRAMS)
|
206
|
+
end
|
207
|
+
|
208
|
+
test "common_startmenu constant is set" do
|
209
|
+
assert_not_nil(Dir::COMMON_STARTMENU)
|
210
|
+
assert_kind_of(String, Dir::COMMON_STARTMENU)
|
211
|
+
end
|
212
|
+
|
213
|
+
test "common_startup constant is set" do
|
214
|
+
assert_not_nil(Dir::COMMON_STARTUP)
|
215
|
+
assert_kind_of(String, Dir::COMMON_STARTUP)
|
216
|
+
end
|
217
|
+
|
218
|
+
test "common_templates constant is set" do
|
219
|
+
assert_not_nil(Dir::COMMON_TEMPLATES)
|
220
|
+
assert_kind_of(String, Dir::COMMON_TEMPLATES)
|
221
|
+
end
|
222
|
+
|
223
|
+
test "common_video constant is set" do
|
224
|
+
assert_not_nil(Dir::COMMON_VIDEO)
|
225
|
+
assert_kind_of(String, Dir::COMMON_VIDEO)
|
226
|
+
end
|
227
|
+
|
228
|
+
test "controls constant is set" do
|
229
|
+
assert_not_nil(Dir::CONTROLS)
|
230
|
+
assert_kind_of(String, Dir::CONTROLS)
|
231
|
+
end
|
232
|
+
|
233
|
+
test "cookies constant is set" do
|
234
|
+
assert_not_nil(Dir::COOKIES)
|
235
|
+
assert_kind_of(String, Dir::COOKIES)
|
236
|
+
end
|
237
|
+
|
238
|
+
test "desktop constant is set" do
|
239
|
+
assert_not_nil(Dir::DESKTOP)
|
240
|
+
assert_kind_of(String, Dir::DESKTOP)
|
241
|
+
end
|
242
|
+
|
243
|
+
test "desktopdirectory is set" do
|
244
|
+
assert_not_nil(Dir::DESKTOPDIRECTORY)
|
245
|
+
assert_kind_of(String, Dir::DESKTOPDIRECTORY)
|
246
|
+
end
|
247
|
+
|
248
|
+
test "drives constant is set" do
|
249
|
+
assert_not_nil(Dir::DRIVES)
|
250
|
+
assert_kind_of(String, Dir::DRIVES)
|
251
|
+
end
|
252
|
+
|
253
|
+
test "favorites constant is set" do
|
254
|
+
assert_not_nil(Dir::FAVORITES)
|
255
|
+
assert_kind_of(String, Dir::FAVORITES)
|
256
|
+
end
|
257
|
+
|
258
|
+
test "fonts constant is set" do
|
259
|
+
assert_not_nil(Dir::FONTS)
|
260
|
+
assert_kind_of(String, Dir::FONTS)
|
261
|
+
end
|
262
|
+
|
263
|
+
test "history constant is set" do
|
264
|
+
assert_not_nil(Dir::HISTORY)
|
265
|
+
assert_kind_of(String, Dir::HISTORY)
|
266
|
+
end
|
267
|
+
|
268
|
+
test "internet constant is set" do
|
269
|
+
assert_not_nil(Dir::INTERNET)
|
270
|
+
assert_kind_of(String, Dir::INTERNET)
|
271
|
+
end
|
272
|
+
|
273
|
+
test "internet_cache constant is set" do
|
274
|
+
assert_not_nil(Dir::INTERNET_CACHE)
|
275
|
+
assert_kind_of(String, Dir::INTERNET_CACHE)
|
276
|
+
end
|
277
|
+
|
278
|
+
test "local_appdata constant is set" do
|
279
|
+
assert_not_nil(Dir::LOCAL_APPDATA)
|
280
|
+
assert_kind_of(String, Dir::LOCAL_APPDATA)
|
281
|
+
end
|
282
|
+
|
283
|
+
test "mydocuments constant is set" do
|
284
|
+
assert_not_nil(Dir::MYDOCUMENTS)
|
285
|
+
assert_kind_of(String, Dir::MYDOCUMENTS)
|
286
|
+
end
|
287
|
+
|
288
|
+
test "mymusic constant is set" do
|
289
|
+
assert_not_nil(Dir::MYMUSIC)
|
290
|
+
assert_kind_of(String, Dir::MYMUSIC)
|
291
|
+
end
|
292
|
+
|
293
|
+
test "mypictures constant is set" do
|
294
|
+
assert_not_nil(Dir::MYPICTURES)
|
295
|
+
assert_kind_of(String, Dir::MYPICTURES)
|
296
|
+
end
|
297
|
+
|
298
|
+
test "myvideo constant is set" do
|
299
|
+
assert_not_nil(Dir::MYVIDEO)
|
300
|
+
assert_kind_of(String, Dir::MYVIDEO)
|
301
|
+
end
|
302
|
+
|
303
|
+
test "nethood constant is set" do
|
304
|
+
assert_not_nil(Dir::NETHOOD)
|
305
|
+
assert_kind_of(String, Dir::NETHOOD)
|
306
|
+
end
|
307
|
+
|
308
|
+
test "network constant is set" do
|
309
|
+
assert_not_nil(Dir::NETWORK)
|
310
|
+
assert_kind_of(String, Dir::NETWORK)
|
311
|
+
end
|
312
|
+
|
313
|
+
test "personal constant is set" do
|
314
|
+
assert_not_nil(Dir::PERSONAL)
|
315
|
+
assert_kind_of(String, Dir::PERSONAL)
|
316
|
+
end
|
317
|
+
|
318
|
+
test "printers cosntant is set" do
|
319
|
+
assert_not_nil(Dir::PRINTERS)
|
320
|
+
assert_kind_of(String, Dir::PRINTERS)
|
321
|
+
end
|
322
|
+
|
323
|
+
test "printhood constant is set" do
|
324
|
+
assert_not_nil(Dir::PRINTHOOD)
|
325
|
+
assert_kind_of(String, Dir::PRINTHOOD)
|
326
|
+
end
|
327
|
+
|
328
|
+
test "profile constant is set" do
|
329
|
+
assert_not_nil(Dir::PROFILE)
|
330
|
+
assert_kind_of(String, Dir::PROFILE)
|
331
|
+
end
|
332
|
+
|
333
|
+
test "program_files constant is set" do
|
334
|
+
assert_not_nil(Dir::PROGRAM_FILES)
|
335
|
+
assert_kind_of(String, Dir::PROGRAM_FILES)
|
336
|
+
end
|
337
|
+
|
338
|
+
test "program_files_common constant is set" do
|
339
|
+
assert_not_nil(Dir::PROGRAM_FILES_COMMON)
|
340
|
+
assert_kind_of(String, Dir::PROGRAM_FILES_COMMON)
|
341
|
+
end
|
342
|
+
|
343
|
+
test "programs constant is set" do
|
344
|
+
assert_not_nil(Dir::PROGRAMS)
|
345
|
+
assert_kind_of(String, Dir::PROGRAMS)
|
346
|
+
end
|
347
|
+
|
348
|
+
test "recent constant is set" do
|
349
|
+
assert_not_nil(Dir::RECENT)
|
350
|
+
assert_kind_of(String, Dir::RECENT)
|
351
|
+
end
|
352
|
+
|
353
|
+
test "sendto constant is set" do
|
354
|
+
assert_not_nil(Dir::SENDTO)
|
355
|
+
assert_kind_of(String, Dir::SENDTO)
|
356
|
+
end
|
357
|
+
|
358
|
+
test "startmenu constant is set" do
|
359
|
+
assert_not_nil(Dir::STARTMENU)
|
360
|
+
assert_kind_of(String, Dir::STARTMENU)
|
361
|
+
end
|
362
|
+
|
363
|
+
test "startup constant is set" do
|
364
|
+
assert_not_nil(Dir::STARTUP)
|
365
|
+
assert_kind_of(String, Dir::STARTUP)
|
366
|
+
end
|
367
|
+
|
368
|
+
test "system constant is set" do
|
369
|
+
assert_not_nil(Dir::SYSTEM)
|
370
|
+
assert_kind_of(String, Dir::SYSTEM)
|
371
|
+
end
|
372
|
+
|
373
|
+
test "templates constant is set" do
|
374
|
+
assert_not_nil(Dir::TEMPLATES)
|
375
|
+
assert_kind_of(String, Dir::TEMPLATES)
|
376
|
+
end
|
377
|
+
|
378
|
+
test "windows constant is set" do
|
379
|
+
assert_not_nil(Dir::WINDOWS)
|
380
|
+
assert_kind_of(String, Dir::WINDOWS)
|
381
|
+
end
|
382
|
+
|
383
|
+
test "ffi functions are private" do
|
384
|
+
assert_not_respond_to(Dir, :SHGetFolderPathW)
|
385
|
+
end
|
386
|
+
|
387
|
+
def teardown
|
388
|
+
FileUtils.rm_rf(@ascii_to)
|
389
|
+
FileUtils.rm_rf(@unicode_to)
|
390
|
+
end
|
391
|
+
|
392
|
+
def self.shutdown
|
393
|
+
FileUtils.rm_rf(@@from)
|
394
|
+
@@test_home = nil
|
395
|
+
@@from = nil
|
396
|
+
end
|
397
|
+
end
|