win32-dir 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
- def test_version
28
- assert_equal('0.4.0', 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 "junction? method returns boolean value" do
73
- assert_respond_to(Dir, :junction?)
74
- assert_nothing_raised{ Dir.create_junction(@ascii_to, @@from) }
75
- assert_false(Dir.junction?(@@from))
76
- assert_true(Dir.junction?(@ascii_to))
77
- end
78
-
79
- test "reparse_dir? is an aliase for junction?" do
80
- assert_respond_to(Dir, :reparse_dir?)
81
- assert_true(Dir.method(:reparse_dir?) == Dir.method(:junction?))
82
- end
83
-
84
- test "empty? method returns expected result" do
85
- assert_respond_to(Dir, :empty?)
86
- assert_false(Dir.empty?("C:\\")) # One would think
87
- assert_true(Dir.empty?(@@from))
88
- end
89
-
90
- test "pwd basic functionality" do
91
- omit_if(@@java)
92
- assert_respond_to(Dir, :pwd)
93
- assert_nothing_raised{ Dir.pwd }
94
- assert_kind_of(String, Dir.pwd)
95
- end
96
-
97
- test "pwd returns full path even if short path was just used" do
98
- omit_if(@@java)
99
- Dir.chdir("C:\\Progra~1")
100
- assert_equal("C:\\Program Files", Dir.pwd)
101
- end
102
-
103
- test "pwd returns full path if long path was just used" do
104
- omit_if(@@java)
105
- Dir.chdir("C:\\Program Files")
106
- assert_equal("C:\\Program Files", Dir.pwd)
107
- end
108
-
109
- test "pwd uses standard case conventions" do
110
- omit_if(@@java)
111
- Dir.chdir("C:\\PROGRAM FILES")
112
- assert_equal("C:\\Program Files", Dir.pwd)
113
- end
114
-
115
- test "pwd converts forward slashes to backslashes" 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 and getwd are aliases" do
122
- omit_if(@@java)
123
- assert_true(Dir.method(:getwd) == Dir.method(:pwd))
124
- end
125
-
126
- test "admintools constant is set" do
127
- assert_not_nil(Dir::ADMINTOOLS)
128
- assert_kind_of(String, Dir::ADMINTOOLS)
129
- end
130
-
131
- test "altstartup constant is set" do
132
- assert_not_nil(Dir::ALTSTARTUP)
133
- assert_kind_of(String, Dir::ALTSTARTUP)
134
- end
135
-
136
- test "appdata constant is set" do
137
- assert_not_nil(Dir::APPDATA)
138
- assert_kind_of(String, Dir::APPDATA)
139
- end
140
-
141
- test "bitbucket constant is set" do
142
- assert_not_nil(Dir::BITBUCKET)
143
- assert_kind_of(String, Dir::BITBUCKET)
144
- end
145
-
146
- test "cdburn area is set" do
147
- assert_not_nil(Dir::CDBURN_AREA)
148
- assert_kind_of(String, Dir::CDBURN_AREA)
149
- end
150
-
151
- test "common admintools is set" do
152
- assert_not_nil(Dir::COMMON_ADMINTOOLS)
153
- assert_kind_of(String, Dir::COMMON_ADMINTOOLS)
154
- end
155
-
156
- test "common_altstartup constant is set" do
157
- assert_not_nil(Dir::COMMON_ALTSTARTUP)
158
- assert_kind_of(String, Dir::COMMON_ALTSTARTUP)
159
- end
160
-
161
- test "common_appdata constant is set" do
162
- assert_not_nil(Dir::COMMON_APPDATA)
163
- assert_kind_of(String, Dir::COMMON_APPDATA)
164
- end
165
-
166
- test "common desktopdirectory constant is set" do
167
- assert_not_nil(Dir::COMMON_DESKTOPDIRECTORY)
168
- assert_kind_of(String, Dir::COMMON_DESKTOPDIRECTORY)
169
- end
170
-
171
- test "common_documents constant is set" do
172
- assert_not_nil(Dir::COMMON_DOCUMENTS)
173
- assert_kind_of(String, Dir::COMMON_DOCUMENTS)
174
- end
175
-
176
- test "common_favorites constant is set" do
177
- assert_not_nil(Dir::COMMON_FAVORITES)
178
- assert_kind_of(String, Dir::COMMON_FAVORITES)
179
- end
180
-
181
- test "common_music constant is set" do
182
- assert_not_nil(Dir::COMMON_MUSIC)
183
- assert_kind_of(String, Dir::COMMON_MUSIC)
184
- end
185
-
186
- test "common_pictures constant is set" do
187
- assert_not_nil(Dir::COMMON_PICTURES)
188
- assert_kind_of(String, Dir::COMMON_PICTURES)
189
- end
190
-
191
- test "common_programs constant is set" do
192
- assert_not_nil(Dir::COMMON_PROGRAMS)
193
- assert_kind_of(String, Dir::COMMON_PROGRAMS)
194
- end
195
-
196
- test "common_startmenu constant is set" do
197
- assert_not_nil(Dir::COMMON_STARTMENU)
198
- assert_kind_of(String, Dir::COMMON_STARTMENU)
199
- end
200
-
201
- test "common_startup constant is set" do
202
- assert_not_nil(Dir::COMMON_STARTUP)
203
- assert_kind_of(String, Dir::COMMON_STARTUP)
204
- end
205
-
206
- test "common_templates constant is set" do
207
- assert_not_nil(Dir::COMMON_TEMPLATES)
208
- assert_kind_of(String, Dir::COMMON_TEMPLATES)
209
- end
210
-
211
- test "common_video constant is set" do
212
- assert_not_nil(Dir::COMMON_VIDEO)
213
- assert_kind_of(String, Dir::COMMON_VIDEO)
214
- end
215
-
216
- test "controls constant is set" do
217
- assert_not_nil(Dir::CONTROLS)
218
- assert_kind_of(String, Dir::CONTROLS)
219
- end
220
-
221
- test "cookies constant is set" do
222
- assert_not_nil(Dir::COOKIES)
223
- assert_kind_of(String, Dir::COOKIES)
224
- end
225
-
226
- test "desktop constant is set" do
227
- assert_not_nil(Dir::DESKTOP)
228
- assert_kind_of(String, Dir::DESKTOP)
229
- end
230
-
231
- test "desktopdirectory is set" do
232
- assert_not_nil(Dir::DESKTOPDIRECTORY)
233
- assert_kind_of(String, Dir::DESKTOPDIRECTORY)
234
- end
235
-
236
- test "drives constant is set" do
237
- assert_not_nil(Dir::DRIVES)
238
- assert_kind_of(String, Dir::DRIVES)
239
- end
240
-
241
- test "favorites constant is set" do
242
- assert_not_nil(Dir::FAVORITES)
243
- assert_kind_of(String, Dir::FAVORITES)
244
- end
245
-
246
- test "fonts constant is set" do
247
- assert_not_nil(Dir::FONTS)
248
- assert_kind_of(String, Dir::FONTS)
249
- end
250
-
251
- test "history constant is set" do
252
- assert_not_nil(Dir::HISTORY)
253
- assert_kind_of(String, Dir::HISTORY)
254
- end
255
-
256
- test "internet constant is set" do
257
- assert_not_nil(Dir::INTERNET)
258
- assert_kind_of(String, Dir::INTERNET)
259
- end
260
-
261
- test "internet_cache constant is set" do
262
- assert_not_nil(Dir::INTERNET_CACHE)
263
- assert_kind_of(String, Dir::INTERNET_CACHE)
264
- end
265
-
266
- test "local_appdata constant is set" do
267
- assert_not_nil(Dir::LOCAL_APPDATA)
268
- assert_kind_of(String, Dir::LOCAL_APPDATA)
269
- end
270
-
271
- test "mydocuments constant is set" do
272
- assert_not_nil(Dir::MYDOCUMENTS)
273
- assert_kind_of(String, Dir::MYDOCUMENTS)
274
- end
275
-
276
- test "mymusic constant is set" do
277
- assert_not_nil(Dir::MYMUSIC)
278
- assert_kind_of(String, Dir::MYMUSIC)
279
- end
280
-
281
- test "mypictures constant is set" do
282
- assert_not_nil(Dir::MYPICTURES)
283
- assert_kind_of(String, Dir::MYPICTURES)
284
- end
285
-
286
- test "myvideo constant is set" do
287
- assert_not_nil(Dir::MYVIDEO)
288
- assert_kind_of(String, Dir::MYVIDEO)
289
- end
290
-
291
- test "nethood constant is set" do
292
- assert_not_nil(Dir::NETHOOD)
293
- assert_kind_of(String, Dir::NETHOOD)
294
- end
295
-
296
- test "network constant is set" do
297
- assert_not_nil(Dir::NETWORK)
298
- assert_kind_of(String, Dir::NETWORK)
299
- end
300
-
301
- test "personal constant is set" do
302
- assert_not_nil(Dir::PERSONAL)
303
- assert_kind_of(String, Dir::PERSONAL)
304
- end
305
-
306
- test "printers cosntant is set" do
307
- assert_not_nil(Dir::PRINTERS)
308
- assert_kind_of(String, Dir::PRINTERS)
309
- end
310
-
311
- test "printhood constant is set" do
312
- assert_not_nil(Dir::PRINTHOOD)
313
- assert_kind_of(String, Dir::PRINTHOOD)
314
- end
315
-
316
- test "profile constant is set" do
317
- assert_not_nil(Dir::PROFILE)
318
- assert_kind_of(String, Dir::PROFILE)
319
- end
320
-
321
- test "program_files constant is set" do
322
- assert_not_nil(Dir::PROGRAM_FILES)
323
- assert_kind_of(String, Dir::PROGRAM_FILES)
324
- end
325
-
326
- test "program_files_common constant is set" do
327
- assert_not_nil(Dir::PROGRAM_FILES_COMMON)
328
- assert_kind_of(String, Dir::PROGRAM_FILES_COMMON)
329
- end
330
-
331
- test "programs constant is set" do
332
- assert_not_nil(Dir::PROGRAMS)
333
- assert_kind_of(String, Dir::PROGRAMS)
334
- end
335
-
336
- test "recent constant is set" do
337
- assert_not_nil(Dir::RECENT)
338
- assert_kind_of(String, Dir::RECENT)
339
- end
340
-
341
- test "sendto constant is set" do
342
- assert_not_nil(Dir::SENDTO)
343
- assert_kind_of(String, Dir::SENDTO)
344
- end
345
-
346
- test "startmenu constant is set" do
347
- assert_not_nil(Dir::STARTMENU)
348
- assert_kind_of(String, Dir::STARTMENU)
349
- end
350
-
351
- test "startup constant is set" do
352
- assert_not_nil(Dir::STARTUP)
353
- assert_kind_of(String, Dir::STARTUP)
354
- end
355
-
356
- test "system constant is set" do
357
- assert_not_nil(Dir::SYSTEM)
358
- assert_kind_of(String, Dir::SYSTEM)
359
- end
360
-
361
- test "templates constant is set" do
362
- assert_not_nil(Dir::TEMPLATES)
363
- assert_kind_of(String, Dir::TEMPLATES)
364
- end
365
-
366
- test "windows constant is set" do
367
- assert_not_nil(Dir::WINDOWS)
368
- assert_kind_of(String, Dir::WINDOWS)
369
- end
370
-
371
- test "ffi functions are private" do
372
- assert_not_respond_to(Dir, :SHGetFolderPathW)
373
- end
374
-
375
- def teardown
376
- FileUtils.rm_rf(@ascii_to)
377
- FileUtils.rm_rf(@unicode_to)
378
- end
379
-
380
- def self.shutdown
381
- FileUtils.rm_rf(@@from)
382
- @@test_home = nil
383
- @@from = nil
384
- end
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