libpath-ruby 0.2.1 → 0.2.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +33 -0
  3. data/README.md +25 -8
  4. data/examples/path_from_arg0.md +43 -43
  5. data/examples/path_from_arg0.rb +25 -23
  6. data/lib/libpath/constants/unix.rb +71 -71
  7. data/lib/libpath/constants/windows.rb +72 -72
  8. data/lib/libpath/constants.rb +18 -19
  9. data/lib/libpath/diagnostics/parameter_checking.rb +25 -25
  10. data/lib/libpath/diagnostics.rb +1 -1
  11. data/lib/libpath/exceptions/libpath_base_exception.rb +13 -13
  12. data/lib/libpath/exceptions/malformed_name_exception.rb +23 -22
  13. data/lib/libpath/exceptions.rb +3 -3
  14. data/lib/libpath/form/unix.rb +104 -103
  15. data/lib/libpath/form/windows.rb +200 -199
  16. data/lib/libpath/form.rb +18 -18
  17. data/lib/libpath/internal_/array.rb +53 -53
  18. data/lib/libpath/internal_/platform.rb +24 -24
  19. data/lib/libpath/internal_/string.rb +20 -17
  20. data/lib/libpath/internal_/unix/form.rb +117 -112
  21. data/lib/libpath/internal_/windows/drive.rb +62 -59
  22. data/lib/libpath/internal_/windows/form.rb +193 -188
  23. data/lib/libpath/libpath.rb +3 -0
  24. data/lib/libpath/path/unix.rb +114 -112
  25. data/lib/libpath/path/windows.rb +120 -118
  26. data/lib/libpath/path.rb +18 -20
  27. data/lib/libpath/util/unix.rb +258 -258
  28. data/lib/libpath/util/windows.rb +400 -400
  29. data/lib/libpath/util.rb +18 -19
  30. data/lib/libpath/version.rb +23 -23
  31. data/lib/libpath.rb +1 -1
  32. data/test/performance/benchmark_drive_letter.rb +50 -10
  33. data/test/performance/benchmark_gsub_string_or_regex.rb +27 -23
  34. data/test/performance/benchmark_rindex2.rb +56 -48
  35. data/test/performance/benchmark_split.rb +16 -10
  36. data/test/unit/compare/ts_all.rb +4 -4
  37. data/test/unit/equate/ts_all.rb +4 -4
  38. data/test/unit/equate/unix/ts_all.rb +4 -4
  39. data/test/unit/equate/windows/ts_all.rb +4 -4
  40. data/test/unit/exceptions/tc_libpath_base_exception.rb +10 -8
  41. data/test/unit/exceptions/tc_malformed_name_exception.rb +14 -12
  42. data/test/unit/exceptions/ts_all.rb +4 -4
  43. data/test/unit/form/tc_absolute_functions.rb +242 -240
  44. data/test/unit/form/ts_all.rb +4 -4
  45. data/test/unit/form/unix/tc_absolute_functions.rb +158 -155
  46. data/test/unit/form/unix/ts_all.rb +4 -4
  47. data/test/unit/form/windows/tc_absolute_functions.rb +628 -625
  48. data/test/unit/form/windows/ts_all.rb +4 -4
  49. data/test/unit/internal_/tc_array.rb +36 -32
  50. data/test/unit/internal_/ts_all.rb +4 -4
  51. data/test/unit/internal_/unix/form/tc_slash_functions.rb +38 -35
  52. data/test/unit/internal_/unix/form/ts_all.rb +4 -4
  53. data/test/unit/internal_/unix/tc_split_path.rb +387 -384
  54. data/test/unit/internal_/unix/ts_all.rb +4 -4
  55. data/test/unit/internal_/windows/form/tc_get_windows_volume.rb +157 -153
  56. data/test/unit/internal_/windows/form/tc_slash_functions.rb +39 -35
  57. data/test/unit/internal_/windows/form/ts_all.rb +4 -4
  58. data/test/unit/internal_/windows/tc_split_path.rb +874 -869
  59. data/test/unit/internal_/windows/ts_all.rb +4 -4
  60. data/test/unit/parse/ts_all.rb +4 -4
  61. data/test/unit/path/tc_path.rb +732 -732
  62. data/test/unit/path/ts_all.rb +4 -4
  63. data/test/unit/path/unix/tc_path.rb +544 -540
  64. data/test/unit/path/unix/ts_all.rb +4 -4
  65. data/test/unit/path/windows/tc_path.rb +608 -603
  66. data/test/unit/path/windows/ts_all.rb +4 -4
  67. data/test/unit/tc_version.rb +25 -22
  68. data/test/unit/ts_all.rb +4 -4
  69. data/test/unit/util/tc_combine_paths.rb +110 -105
  70. data/test/unit/util/tc_derive_relative_path.rb +8 -3
  71. data/test/unit/util/tc_make_path_canonical.rb +142 -138
  72. data/test/unit/util/ts_all.rb +4 -4
  73. data/test/unit/util/unix/tc_combine_paths.rb +38 -34
  74. data/test/unit/util/unix/tc_derive_relative_path.rb +80 -75
  75. data/test/unit/util/unix/tc_make_path_absolute.rb +74 -70
  76. data/test/unit/util/unix/tc_make_path_canonical.rb +95 -90
  77. data/test/unit/util/unix/ts_all.rb +4 -4
  78. data/test/unit/util/windows/tc_combine_paths.rb +82 -77
  79. data/test/unit/util/windows/tc_derive_relative_path.rb +98 -93
  80. data/test/unit/util/windows/tc_make_path_absolute.rb +105 -101
  81. data/test/unit/util/windows/tc_make_path_canonical.rb +158 -153
  82. data/test/unit/util/windows/ts_all.rb +4 -4
  83. metadata +9 -8
@@ -2,880 +2,885 @@
2
2
 
3
3
  $:.unshift File.join(File.dirname(__FILE__), *(['..'] * 4), 'lib')
4
4
 
5
+
5
6
  require 'libpath/internal_/windows/form'
6
7
 
7
8
  require 'test/unit'
8
9
 
10
+
9
11
  class Test_LibPath_Internal_Windows_Form_split_path < Test::Unit::TestCase
10
12
 
11
- F = ::LibPath::Internal_::Windows::Form
12
-
13
- def test_empty
14
-
15
- r = F.split_path ''
16
-
17
- assert_kind_of ::Array, r
18
- assert_equal 8, r.size
19
- assert_nil r[0]
20
- assert_nil r[1]
21
- assert_nil r[2]
22
- assert_nil r[3]
23
- assert_nil r[4]
24
- assert_nil r[5]
25
- assert_kind_of ::Array, r[6]
26
- assert_empty r[6]
27
- assert_kind_of ::Array, r[7]
28
- assert_empty r[7]
29
- end
30
-
31
- def test_dot
32
-
33
- r = F.split_path '.'
34
-
35
- assert_kind_of ::Array, r
36
- assert_equal 8, r.size
37
- assert_equal '.', r[0]
38
- assert_nil r[1]
39
- assert_nil r[2]
40
- assert_equal '.', r[3]
41
- assert_equal '.', r[4]
42
- assert_nil r[5]
43
- assert_kind_of ::Array, r[6]
44
- assert_empty r[6]
45
- assert_kind_of ::Array, r[7]
46
- assert_empty r[7]
47
- end
48
-
49
- def test_dots
50
-
51
- r = F.split_path '..'
52
-
53
- assert_kind_of ::Array, r
54
- assert_equal 8, r.size
55
- assert_equal '..', r[0]
56
- assert_nil r[1]
57
- assert_nil r[2]
58
- assert_equal '..', r[3]
59
- assert_equal '..', r[4]
60
- assert_nil r[5]
61
- assert_kind_of ::Array, r[6]
62
- assert_empty r[6]
63
- assert_kind_of ::Array, r[7]
64
- assert_empty r[7]
65
- end
66
-
67
- def test_stems
68
-
69
- r = F.split_path 'a'
70
-
71
- assert_kind_of ::Array, r
72
- assert_equal 8, r.size
73
- assert_equal 'a', r[0]
74
- assert_nil r[1]
75
- assert_nil r[2]
76
- assert_equal 'a', r[3]
77
- assert_equal 'a', r[4]
78
- assert_nil r[5]
79
- assert_kind_of ::Array, r[6]
80
- assert_empty r[6]
81
- assert_kind_of ::Array, r[7]
82
- assert_empty r[7]
83
-
84
- r = F.split_path 'abc'
85
-
86
- assert_kind_of ::Array, r
87
- assert_equal 8, r.size
88
- assert_equal 'abc', r[0]
89
- assert_nil r[1]
90
- assert_nil r[2]
91
- assert_equal 'abc', r[3]
92
- assert_equal 'abc', r[4]
93
- assert_nil r[5]
94
- assert_kind_of ::Array, r[6]
95
- assert_empty r[6]
96
- assert_kind_of ::Array, r[7]
97
- assert_empty r[7]
98
-
99
- r = F.split_path 'abcdefghi'
100
-
101
- assert_kind_of ::Array, r
102
- assert_equal 8, r.size
103
- assert_equal 'abcdefghi', r[0]
104
- assert_nil r[1]
105
- assert_nil r[2]
106
- assert_equal 'abcdefghi', r[3]
107
- assert_equal 'abcdefghi', r[4]
108
- assert_nil r[5]
109
- assert_kind_of ::Array, r[6]
110
- assert_empty r[6]
111
- assert_kind_of ::Array, r[7]
112
- assert_empty r[7]
113
- end
114
-
115
- def test_basenames
116
-
117
- r = F.split_path 'a.x'
118
-
119
- assert_kind_of ::Array, r
120
- assert_equal 8, r.size
121
- assert_equal 'a.x', r[0]
122
- assert_nil r[1]
123
- assert_nil r[2]
124
- assert_equal 'a.x', r[3]
125
- assert_equal 'a', r[4]
126
- assert_equal '.x', r[5]
127
- assert_kind_of ::Array, r[6]
128
- assert_empty r[6]
129
- assert_kind_of ::Array, r[7]
130
- assert_empty r[7]
131
-
132
- r = F.split_path 'abc.ext'
133
-
134
- assert_kind_of ::Array, r
135
- assert_equal 8, r.size
136
- assert_equal 'abc.ext', r[0]
137
- assert_nil r[1]
138
- assert_nil r[2]
139
- assert_equal 'abc.ext', r[3]
140
- assert_equal 'abc', r[4]
141
- assert_equal '.ext', r[5]
142
- assert_kind_of ::Array, r[6]
143
- assert_empty r[6]
144
- assert_kind_of ::Array, r[7]
145
- assert_empty r[7]
146
-
147
- r = F.split_path 'abcd.efghi.ext'
148
-
149
- assert_kind_of ::Array, r
150
- assert_equal 8, r.size
151
- assert_nil r[1]
152
- assert_nil r[2]
153
- assert_equal 'abcd.efghi.ext', r[3]
154
- assert_equal 'abcd.efghi', r[4]
155
- assert_equal '.ext', r[5]
156
- assert_kind_of ::Array, r[6]
157
- assert_empty r[6]
158
- assert_kind_of ::Array, r[7]
159
- assert_empty r[7]
160
- end
161
-
162
- def test_directories
163
-
164
- r = F.split_path 'a/'
165
-
166
- assert_kind_of ::Array, r
167
- assert_equal 8, r.size
168
- assert_equal 'a/', r[0]
169
- assert_nil r[1]
170
- assert_equal 'a/', r[2]
171
- assert_nil r[3]
172
- assert_nil r[4]
173
- assert_nil r[5]
174
- assert_kind_of ::Array, r[6]
175
- assert_equal [ 'a/' ], r[6]
176
- assert_kind_of ::Array, r[7]
177
- assert_equal [ 'a/' ], r[7]
178
-
179
- r = F.split_path 'a\\'
180
-
181
- assert_kind_of ::Array, r
182
- assert_equal 8, r.size
183
- assert_equal 'a\\', r[0]
184
- assert_nil r[1]
185
- assert_equal 'a\\', r[2]
186
- assert_nil r[3]
187
- assert_nil r[4]
188
- assert_nil r[5]
189
- assert_kind_of ::Array, r[6]
190
- assert_equal [ 'a\\' ], r[6]
191
- assert_kind_of ::Array, r[7]
192
- assert_equal [ 'a\\' ], r[7]
193
-
194
- r = F.split_path 'abc/'
195
-
196
- assert_kind_of ::Array, r
197
- assert_equal 8, r.size
198
- assert_equal 'abc/', r[0]
199
- assert_nil r[1]
200
- assert_equal 'abc/', r[2]
201
- assert_nil r[3]
202
- assert_nil r[4]
203
- assert_nil r[5]
204
- assert_kind_of ::Array, r[6]
205
- assert_equal [ 'abc/' ], r[6]
206
- assert_kind_of ::Array, r[7]
207
- assert_equal [ 'abc/' ], r[7]
208
-
209
- r = F.split_path 'abc\\'
210
-
211
- assert_kind_of ::Array, r
212
- assert_equal 8, r.size
213
- assert_equal 'abc\\', r[0]
214
- assert_nil r[1]
215
- assert_equal 'abc\\', r[2]
216
- assert_nil r[3]
217
- assert_nil r[4]
218
- assert_nil r[5]
219
- assert_kind_of ::Array, r[6]
220
- assert_equal [ 'abc\\' ], r[6]
221
- assert_kind_of ::Array, r[7]
222
- assert_equal [ 'abc\\' ], r[7]
223
-
224
- r = F.split_path 'abc/def/'
225
-
226
- assert_kind_of ::Array, r
227
- assert_equal 8, r.size
228
- assert_equal 'abc/def/', r[0]
229
- assert_nil r[1]
230
- assert_equal 'abc/def/', r[2]
231
- assert_nil r[3]
232
- assert_nil r[4]
233
- assert_nil r[5]
234
- assert_kind_of ::Array, r[6]
235
- assert_equal [ 'abc/', 'def/' ], r[6]
236
- assert_kind_of ::Array, r[7]
237
- assert_equal [ 'abc/', 'def/' ], r[7]
238
-
239
- r = F.split_path 'abc\\def\\'
240
-
241
- assert_kind_of ::Array, r
242
- assert_equal 8, r.size
243
- assert_equal 'abc\\def\\', r[0]
244
- assert_nil r[1]
245
- assert_equal 'abc\\def\\', r[2]
246
- assert_nil r[3]
247
- assert_nil r[4]
248
- assert_nil r[5]
249
- assert_kind_of ::Array, r[6]
250
- assert_equal [ 'abc\\', 'def\\' ], r[6]
251
- assert_kind_of ::Array, r[7]
252
- assert_equal [ 'abc\\', 'def\\' ], r[7]
253
-
254
- r = F.split_path '/'
255
-
256
- assert_kind_of ::Array, r
257
- assert_equal 8, r.size
258
- assert_equal '/', r[0]
259
- assert_nil r[1]
260
- assert_equal '/', r[2]
261
- assert_nil r[3]
262
- assert_nil r[4]
263
- assert_nil r[5]
264
- assert_kind_of ::Array, r[6]
265
- assert_equal [ '/' ], r[6]
266
- assert_kind_of ::Array, r[7]
267
- assert_equal [ '/' ], r[7]
268
-
269
- r = F.split_path '\\'
270
-
271
- assert_kind_of ::Array, r
272
- assert_equal 8, r.size
273
- assert_equal '\\', r[0]
274
- assert_nil r[1]
275
- assert_equal '\\', r[2]
276
- assert_nil r[3]
277
- assert_nil r[4]
278
- assert_nil r[5]
279
- assert_kind_of ::Array, r[6]
280
- assert_equal [ '\\' ], r[6]
281
- assert_kind_of ::Array, r[7]
282
- assert_equal [ '\\' ], r[7]
283
-
284
- r = F.split_path '/abc/'
285
-
286
- assert_kind_of ::Array, r
287
- assert_equal 8, r.size
288
- assert_equal '/abc/', r[0]
289
- assert_nil r[1]
290
- assert_equal '/abc/', r[2]
291
- assert_nil r[3]
292
- assert_nil r[4]
293
- assert_nil r[5]
294
- assert_kind_of ::Array, r[6]
295
- assert_equal [ '/', 'abc/' ], r[6]
296
- assert_kind_of ::Array, r[7]
297
- assert_equal [ '/', 'abc/' ], r[7]
298
-
299
- r = F.split_path '\\abc\\'
300
-
301
- assert_kind_of ::Array, r
302
- assert_equal 8, r.size
303
- assert_equal '\\abc\\', r[0]
304
- assert_nil r[1]
305
- assert_equal '\\abc\\', r[2]
306
- assert_nil r[3]
307
- assert_nil r[4]
308
- assert_nil r[5]
309
- assert_kind_of ::Array, r[6]
310
- assert_equal [ '\\', 'abc\\' ], r[6]
311
- assert_kind_of ::Array, r[7]
312
- assert_equal [ '\\', 'abc\\' ], r[7]
313
-
314
- r = F.split_path '/abc/def/'
315
-
316
- assert_kind_of ::Array, r
317
- assert_equal 8, r.size
318
- assert_equal '/abc/def/', r[0]
319
- assert_nil r[1]
320
- assert_equal '/abc/def/', r[2]
321
- assert_nil r[3]
322
- assert_nil r[4]
323
- assert_nil r[5]
324
- assert_kind_of ::Array, r[6]
325
- assert_equal [ '/', 'abc/', 'def/' ], r[6]
326
- assert_kind_of ::Array, r[7]
327
- assert_equal [ '/', 'abc/', 'def/' ], r[7]
328
-
329
- r = F.split_path '\\abc\\def\\'
330
-
331
- assert_kind_of ::Array, r
332
- assert_equal 8, r.size
333
- assert_equal '\\abc\\def\\', r[0]
334
- assert_nil r[1]
335
- assert_equal '\\abc\\def\\', r[2]
336
- assert_nil r[3]
337
- assert_nil r[4]
338
- assert_nil r[5]
339
- assert_kind_of ::Array, r[6]
340
- assert_equal [ '\\', 'abc\\', 'def\\' ], r[6]
341
- assert_kind_of ::Array, r[7]
342
- assert_equal [ '\\', 'abc\\', 'def\\' ], r[7]
343
-
344
- r = F.split_path '~/abc/def/'
345
-
346
- assert_kind_of ::Array, r
347
- assert_equal 8, r.size
348
- assert_equal '~/abc/def/', r[0]
349
- assert_nil r[1]
350
- assert_equal '~/abc/def/', r[2]
351
- assert_nil r[3]
352
- assert_nil r[4]
353
- assert_nil r[5]
354
- assert_kind_of ::Array, r[6]
355
- assert_equal [ '~/', 'abc/', 'def/' ], r[6]
356
- assert_kind_of ::Array, r[7]
357
- assert_equal [ '~/', 'abc/', 'def/' ], r[7]
358
-
359
- r = F.split_path '~\\abc\\def\\'
360
-
361
- assert_kind_of ::Array, r
362
- assert_equal 8, r.size
363
- assert_equal '~\\abc\\def\\', r[0]
364
- assert_nil r[1]
365
- assert_equal '~\\abc\\def\\', r[2]
366
- assert_nil r[3]
367
- assert_nil r[4]
368
- assert_nil r[5]
369
- assert_kind_of ::Array, r[6]
370
- assert_equal [ '~\\', 'abc\\', 'def\\' ], r[6]
371
- assert_kind_of ::Array, r[7]
372
- assert_equal [ '~\\', 'abc\\', 'def\\' ], r[7]
373
-
374
- r = F.split_path '~/abc\\def/'
375
-
376
- assert_kind_of ::Array, r
377
- assert_equal 8, r.size
378
- assert_equal '~/abc\\def/', r[0]
379
- assert_nil r[1]
380
- assert_equal '~/abc\\def/', r[2]
381
- assert_nil r[3]
382
- assert_nil r[4]
383
- assert_nil r[5]
384
- assert_kind_of ::Array, r[6]
385
- assert_equal [ '~/', 'abc\\', 'def/' ], r[6]
386
- assert_kind_of ::Array, r[7]
387
- assert_equal [ '~/', 'abc\\', 'def/' ], r[7]
388
- end
389
-
390
- def test_paths
391
-
392
- r = F.split_path 'a/b'
393
-
394
- assert_kind_of ::Array, r
395
- assert_equal 8, r.size
396
- assert_equal 'a/b', r[0]
397
- assert_nil r[1]
398
- assert_equal 'a/', r[2]
399
- assert_equal 'b', r[3]
400
- assert_equal 'b', r[4]
401
- assert_nil r[5]
402
- assert_kind_of ::Array, r[6]
403
- assert_equal [ 'a/' ], r[6]
404
- assert_kind_of ::Array, r[7]
405
- assert_equal [ 'a/' ], r[7]
406
-
407
- r = F.split_path 'a\\b'
408
-
409
- assert_kind_of ::Array, r
410
- assert_equal 8, r.size
411
- assert_equal 'a\\b', r[0]
412
- assert_nil r[1]
413
- assert_equal 'a\\', r[2]
414
- assert_equal 'b', r[3]
415
- assert_equal 'b', r[4]
416
- assert_nil r[5]
417
- assert_kind_of ::Array, r[6]
418
- assert_equal [ 'a\\' ], r[6]
419
- assert_kind_of ::Array, r[7]
420
- assert_equal [ 'a\\' ], r[7]
421
-
422
- r = F.split_path 'abc/file.ext'
423
-
424
- assert_kind_of ::Array, r
425
- assert_equal 8, r.size
426
- assert_equal 'abc/file.ext', r[0]
427
- assert_nil r[1]
428
- assert_equal 'abc/', r[2]
429
- assert_equal 'file.ext', r[3]
430
- assert_equal 'file', r[4]
431
- assert_equal '.ext', r[5]
432
- assert_kind_of ::Array, r[6]
433
- assert_equal [ 'abc/' ], r[6]
434
- assert_kind_of ::Array, r[7]
435
- assert_equal [ 'abc/' ], r[7]
436
-
437
- r = F.split_path 'abc\\file.ext'
438
-
439
- assert_kind_of ::Array, r
440
- assert_equal 8, r.size
441
- assert_equal 'abc\\file.ext', r[0]
442
- assert_nil r[1]
443
- assert_equal 'abc\\', r[2]
444
- assert_equal 'file.ext', r[3]
445
- assert_equal 'file', r[4]
446
- assert_equal '.ext', r[5]
447
- assert_kind_of ::Array, r[6]
448
- assert_equal [ 'abc\\' ], r[6]
449
- assert_kind_of ::Array, r[7]
450
- assert_equal [ 'abc\\' ], r[7]
451
-
452
- r = F.split_path '/abc/file.ext'
453
-
454
- assert_kind_of ::Array, r
455
- assert_equal 8, r.size
456
- assert_equal '/abc/file.ext', r[0]
457
- assert_nil r[1]
458
- assert_equal '/abc/', r[2]
459
- assert_equal 'file.ext', r[3]
460
- assert_equal 'file', r[4]
461
- assert_equal '.ext', r[5]
462
- assert_kind_of ::Array, r[6]
463
- assert_equal [ '/', 'abc/' ], r[6]
464
- assert_kind_of ::Array, r[7]
465
- assert_equal [ '/', 'abc/' ], r[7]
466
-
467
- r = F.split_path '\\abc\\file.ext'
468
-
469
- assert_kind_of ::Array, r
470
- assert_equal 8, r.size
471
- assert_equal '\\abc\\file.ext', r[0]
472
- assert_nil r[1]
473
- assert_equal '\\abc\\', r[2]
474
- assert_equal 'file.ext', r[3]
475
- assert_equal 'file', r[4]
476
- assert_equal '.ext', r[5]
477
- assert_kind_of ::Array, r[6]
478
- assert_equal [ '\\', 'abc\\' ], r[6]
479
- assert_kind_of ::Array, r[7]
480
- assert_equal [ '\\', 'abc\\' ], r[7]
481
-
482
- r = F.split_path '/abc/.ext'
483
-
484
- assert_kind_of ::Array, r
485
- assert_equal 8, r.size
486
- assert_equal '/abc/.ext', r[0]
487
- assert_nil r[1]
488
- assert_equal '/abc/', r[2]
489
- assert_equal '.ext', r[3]
490
- assert_nil r[4]
491
- assert_equal '.ext', r[5]
492
- assert_kind_of ::Array, r[6]
493
- assert_equal [ '/', 'abc/' ], r[6]
494
- assert_kind_of ::Array, r[7]
495
- assert_equal [ '/', 'abc/' ], r[7]
496
-
497
- r = F.split_path '\\abc\\.ext'
498
-
499
- assert_kind_of ::Array, r
500
- assert_equal 8, r.size
501
- assert_equal '\\abc\\.ext', r[0]
502
- assert_nil r[1]
503
- assert_equal '\\abc\\', r[2]
504
- assert_equal '.ext', r[3]
505
- assert_nil r[4]
506
- assert_equal '.ext', r[5]
507
- assert_kind_of ::Array, r[6]
508
- assert_equal [ '\\', 'abc\\' ], r[6]
509
- assert_kind_of ::Array, r[7]
510
- assert_equal [ '\\', 'abc\\' ], r[7]
511
-
512
- r = F.split_path '/abc/ext.'
513
-
514
- assert_kind_of ::Array, r
515
- assert_equal 8, r.size
516
- assert_equal '/abc/ext.', r[0]
517
- assert_nil r[1]
518
- assert_equal '/abc/', r[2]
519
- assert_equal 'ext.', r[3]
520
- assert_equal 'ext', r[4]
521
- assert_equal '.', r[5]
522
- assert_kind_of ::Array, r[6]
523
- assert_equal [ '/', 'abc/' ], r[6]
524
- assert_kind_of ::Array, r[7]
525
- assert_equal [ '/', 'abc/' ], r[7]
526
-
527
- r = F.split_path '\\abc\\ext.'
528
-
529
- assert_kind_of ::Array, r
530
- assert_equal 8, r.size
531
- assert_equal '\\abc\\ext.', r[0]
532
- assert_nil r[1]
533
- assert_equal '\\abc\\', r[2]
534
- assert_equal 'ext.', r[3]
535
- assert_equal 'ext', r[4]
536
- assert_equal '.', r[5]
537
- assert_kind_of ::Array, r[6]
538
- assert_equal [ '\\', 'abc\\' ], r[6]
539
- assert_kind_of ::Array, r[7]
540
- assert_equal [ '\\', 'abc\\' ], r[7]
541
- end
542
-
543
- def test_paths_with_dots_basenames
544
-
545
- r = F.split_path '/.'
546
-
547
- assert_kind_of ::Array, r
548
- assert_equal 8, r.size
549
- assert_equal '/.', r[0]
550
- assert_nil r[1]
551
- assert_equal '/', r[2]
552
- assert_equal '.', r[3]
553
- assert_equal '.', r[4]
554
- assert_nil r[5]
555
- assert_kind_of ::Array, r[6]
556
- assert_equal [ '/' ], r[6]
557
- assert_kind_of ::Array, r[7]
558
- assert_equal [ '/' ], r[7]
559
-
560
- r = F.split_path '\\.'
561
-
562
- assert_kind_of ::Array, r
563
- assert_equal 8, r.size
564
- assert_equal '\\.', r[0]
565
- assert_nil r[1]
566
- assert_equal '\\', r[2]
567
- assert_equal '.', r[3]
568
- assert_equal '.', r[4]
569
- assert_nil r[5]
570
- assert_kind_of ::Array, r[6]
571
- assert_equal [ '\\' ], r[6]
572
- assert_kind_of ::Array, r[7]
573
- assert_equal [ '\\' ], r[7]
574
-
575
- r = F.split_path '/..'
576
-
577
- assert_kind_of ::Array, r
578
- assert_equal 8, r.size
579
- assert_equal '/..', r[0]
580
- assert_nil r[1]
581
- assert_equal '/', r[2]
582
- assert_equal '..', r[3]
583
- assert_equal '..', r[4]
584
- assert_nil r[5]
585
- assert_kind_of ::Array, r[6]
586
- assert_equal [ '/' ], r[6]
587
- assert_kind_of ::Array, r[7]
588
- assert_equal [ '/' ], r[7]
589
-
590
- r = F.split_path '\\..'
591
-
592
- assert_kind_of ::Array, r
593
- assert_equal 8, r.size
594
- assert_equal '\\..', r[0]
595
- assert_nil r[1]
596
- assert_equal '\\', r[2]
597
- assert_equal '..', r[3]
598
- assert_equal '..', r[4]
599
- assert_nil r[5]
600
- assert_kind_of ::Array, r[6]
601
- assert_equal [ '\\' ], r[6]
602
- assert_kind_of ::Array, r[7]
603
- assert_equal [ '\\' ], r[7]
604
-
605
- r = F.split_path './..'
606
-
607
- assert_kind_of ::Array, r
608
- assert_equal 8, r.size
609
- assert_equal './..', r[0]
610
- assert_nil r[1]
611
- assert_equal './', r[2]
612
- assert_equal '..', r[3]
613
- assert_equal '..', r[4]
614
- assert_nil r[5]
615
- assert_kind_of ::Array, r[6]
616
- assert_equal [ './' ], r[6]
617
- assert_kind_of ::Array, r[7]
618
- assert_equal [ './' ], r[7]
619
-
620
- r = F.split_path '.\\..'
621
-
622
- assert_kind_of ::Array, r
623
- assert_equal 8, r.size
624
- assert_equal '.\\..', r[0]
625
- assert_nil r[1]
626
- assert_equal '.\\', r[2]
627
- assert_equal '..', r[3]
628
- assert_equal '..', r[4]
629
- assert_nil r[5]
630
- assert_kind_of ::Array, r[6]
631
- assert_equal [ '.\\' ], r[6]
632
- assert_kind_of ::Array, r[7]
633
- assert_equal [ '.\\' ], r[7]
634
- end
635
-
636
- def test_paths_with_drives_form1
637
-
638
- r = F.split_path 'C:/abc/file.ext'
639
-
640
- assert_kind_of ::Array, r
641
- assert_equal 8, r.size
642
- assert_equal 'C:/abc/file.ext', r[0]
643
- assert_equal 'C:', r[1]
644
- assert_equal :form_1, r[1].form
645
- assert_equal '/abc/', r[2]
646
- assert_equal 'file.ext', r[3]
647
- assert_equal 'file', r[4]
648
- assert_equal '.ext', r[5]
649
- assert_kind_of ::Array, r[6]
650
- assert_equal [ '/', 'abc/' ], r[6]
651
- assert_kind_of ::Array, r[7]
652
- assert_equal [ 'C:/', 'abc/' ], r[7]
653
-
654
- r = F.split_path 'C:\\abc\\file.ext'
655
-
656
- assert_kind_of ::Array, r
657
- assert_equal 8, r.size
658
- assert_equal 'C:\\abc\\file.ext', r[0]
659
- assert_equal 'C:', r[1]
660
- assert_equal :form_1, r[1].form
661
- assert_equal '\\abc\\', r[2]
662
- assert_equal 'file.ext', r[3]
663
- assert_equal 'file', r[4]
664
- assert_equal '.ext', r[5]
665
- assert_kind_of ::Array, r[6]
666
- assert_equal [ '\\', 'abc\\' ], r[6]
667
- assert_kind_of ::Array, r[7]
668
- assert_equal [ 'C:\\', 'abc\\' ], r[7]
669
- end
670
-
671
- def test_paths_with_drives_form3
672
-
673
- r = F.split_path '\\\\?\\d:/abc/file.ext'
674
-
675
- assert_kind_of ::Array, r
676
- assert_equal 8, r.size
677
- assert_equal '\\\\?\\d:/abc/file.ext', r[0]
678
- assert_equal '\\\\?\\d:', r[1]
679
- assert_equal :form_3, r[1].form
680
- assert_equal '/abc/', r[2]
681
- assert_equal 'file.ext', r[3]
682
- assert_equal 'file', r[4]
683
- assert_equal '.ext', r[5]
684
- assert_kind_of ::Array, r[6]
685
- assert_equal [ '/', 'abc/' ], r[6]
686
- assert_kind_of ::Array, r[7]
687
- assert_equal [ '\\\\?\\d:/', 'abc/' ], r[7]
688
-
689
- r = F.split_path '\\\\?\\d:\\abc\\file.ext'
690
-
691
- assert_kind_of ::Array, r
692
- assert_equal 8, r.size
693
- assert_equal '\\\\?\\d:\\abc\\file.ext', r[0]
694
- assert_equal '\\\\?\\d:', r[1]
695
- assert_equal :form_3, r[1].form
696
- assert_equal '\\abc\\', r[2]
697
- assert_equal 'file.ext', r[3]
698
- assert_equal 'file', r[4]
699
- assert_equal '.ext', r[5]
700
- assert_kind_of ::Array, r[6]
701
- assert_equal [ '\\', 'abc\\' ], r[6]
702
- assert_kind_of ::Array, r[7]
703
- assert_equal [ '\\\\?\\d:\\', 'abc\\' ], r[7]
704
- end
705
-
706
- def test_paths_with_UNC_form2
707
-
708
- r = F.split_path '\\\\101.202.303.404:1234\\some-share-or-other\\abc\\file.ext'
709
-
710
- assert_kind_of ::Array, r
711
- assert_equal 8, r.size
712
- assert_equal '\\\\101.202.303.404:1234\\some-share-or-other\\abc\\file.ext', r[0]
713
- assert_equal '\\\\101.202.303.404:1234\\some-share-or-other', r[1]
714
- assert_equal :form_2, r[1].form
715
- assert_equal '\\abc\\', r[2]
716
- assert_equal 'file.ext', r[3]
717
- assert_equal 'file', r[4]
718
- assert_equal '.ext', r[5]
719
- assert_kind_of ::Array, r[6]
720
- assert_equal [ '\\', 'abc\\' ], r[6]
721
- assert_kind_of ::Array, r[7]
722
- assert_equal [ '\\\\101.202.303.404:1234\\some-share-or-other\\', 'abc\\' ], r[7]
723
-
724
- r = F.split_path '\\\\101.202.303.404:1234\\some-share-or-other\\abc/file.ext'
725
-
726
- assert_kind_of ::Array, r
727
- assert_equal 8, r.size
728
- assert_equal '\\\\101.202.303.404:1234\\some-share-or-other\\abc/file.ext', r[0]
729
- assert_equal '\\\\101.202.303.404:1234\\some-share-or-other', r[1]
730
- assert_equal :form_2, r[1].form
731
- assert_equal '\\abc/', r[2]
732
- assert_equal 'file.ext', r[3]
733
- assert_equal 'file', r[4]
734
- assert_equal '.ext', r[5]
735
- assert_kind_of ::Array, r[6]
736
- assert_equal [ '\\', 'abc/' ], r[6]
737
- assert_kind_of ::Array, r[7]
738
- assert_equal [ '\\\\101.202.303.404:1234\\some-share-or-other\\', 'abc/' ], r[7]
739
- end
740
-
741
- def test_paths_with_UNC_form4
742
-
743
- r = F.split_path '\\\\?\\101.202.303.404:1234\\some-share-or-other\\abc\\file.ext'
744
-
745
- assert_kind_of ::Array, r
746
- assert_equal 8, r.size
747
- assert_equal '\\\\?\\101.202.303.404:1234\\some-share-or-other\\abc\\file.ext', r[0]
748
- assert_equal '\\\\?\\101.202.303.404:1234\\some-share-or-other', r[1]
749
- assert_equal :form_4, r[1].form
750
- assert_equal '\\abc\\', r[2]
751
- assert_equal 'file.ext', r[3]
752
- assert_equal 'file', r[4]
753
- assert_equal '.ext', r[5]
754
- assert_kind_of ::Array, r[6]
755
- assert_equal [ '\\', 'abc\\' ], r[6]
756
- assert_kind_of ::Array, r[7]
757
- assert_equal [ '\\\\?\\101.202.303.404:1234\\some-share-or-other\\', 'abc\\' ], r[7]
758
-
759
- r = F.split_path '\\\\?\\101.202.303.404:1234\\some-share-or-other\\abc/file.ext'
760
-
761
- assert_kind_of ::Array, r
762
- assert_equal 8, r.size
763
- assert_equal '\\\\?\\101.202.303.404:1234\\some-share-or-other\\abc/file.ext', r[0]
764
- assert_equal '\\\\?\\101.202.303.404:1234\\some-share-or-other', r[1]
765
- assert_equal :form_4, r[1].form
766
- assert_equal '\\abc/', r[2]
767
- assert_equal 'file.ext', r[3]
768
- assert_equal 'file', r[4]
769
- assert_equal '.ext', r[5]
770
- assert_kind_of ::Array, r[6]
771
- assert_equal [ '\\', 'abc/' ], r[6]
772
- assert_kind_of ::Array, r[7]
773
- assert_equal [ '\\\\?\\101.202.303.404:1234\\some-share-or-other\\', 'abc/' ], r[7]
774
- end
775
-
776
- def test_paths_with_UNC_form5
777
-
778
- r = F.split_path '\\\\?\\UNC\\101.202.303.404:1234\\some-share-or-other\\abc\\file.ext'
779
-
780
- assert_kind_of ::Array, r
781
- assert_equal 8, r.size
782
- assert_equal '\\\\?\\UNC\\101.202.303.404:1234\\some-share-or-other\\abc\\file.ext', r[0]
783
- assert_equal '\\\\?\\UNC\\101.202.303.404:1234\\some-share-or-other', r[1]
784
- assert_equal :form_5, r[1].form
785
- assert_equal '\\abc\\', r[2]
786
- assert_equal 'file.ext', r[3]
787
- assert_equal 'file', r[4]
788
- assert_equal '.ext', r[5]
789
- assert_kind_of ::Array, r[6]
790
- assert_equal [ '\\', 'abc\\' ], r[6]
791
- assert_kind_of ::Array, r[7]
792
- assert_equal [ '\\\\?\\UNC\\101.202.303.404:1234\\some-share-or-other\\', 'abc\\' ], r[7]
793
-
794
- r = F.split_path '\\\\?\\UNC\\101.202.303.404:1234\\some-share-or-other\\abc/file.ext'
795
-
796
- assert_kind_of ::Array, r
797
- assert_equal 8, r.size
798
- assert_equal '\\\\?\\UNC\\101.202.303.404:1234\\some-share-or-other\\abc/file.ext', r[0]
799
- assert_equal '\\\\?\\UNC\\101.202.303.404:1234\\some-share-or-other', r[1]
800
- assert_equal :form_5, r[1].form
801
- assert_equal '\\abc/', r[2]
802
- assert_equal 'file.ext', r[3]
803
- assert_equal 'file', r[4]
804
- assert_equal '.ext', r[5]
805
- assert_kind_of ::Array, r[6]
806
- assert_equal [ '\\', 'abc/' ], r[6]
807
- assert_kind_of ::Array, r[7]
808
- assert_equal [ '\\\\?\\UNC\\101.202.303.404:1234\\some-share-or-other\\', 'abc/' ], r[7]
809
- end
810
-
811
- def test_paths_with_device_form6
812
-
813
- r = F.split_path '\\\\.\\{some-device-name#abcd}\\abc\\file.ext'
814
-
815
- assert_kind_of ::Array, r
816
- assert_equal 8, r.size
817
- assert_equal '\\\\.\\{some-device-name#abcd}\\abc\\file.ext', r[0]
818
- assert_equal '\\\\.\\{some-device-name#abcd}', r[1]
819
- assert_equal :form_6, r[1].form
820
- assert_equal '\\abc\\', r[2]
821
- assert_equal 'file.ext', r[3]
822
- assert_equal 'file', r[4]
823
- assert_equal '.ext', r[5]
824
- assert_kind_of ::Array, r[6]
825
- assert_equal [ '\\', 'abc\\' ], r[6]
826
- assert_kind_of ::Array, r[7]
827
- assert_equal [ '\\\\.\\{some-device-name#abcd}\\', 'abc\\' ], r[7]
828
-
829
- r = F.split_path '\\\\.\\{some-device-name#abcd}\\abc/file.ext'
830
-
831
- assert_kind_of ::Array, r
832
- assert_equal 8, r.size
833
- assert_equal '\\\\.\\{some-device-name#abcd}\\abc/file.ext', r[0]
834
- assert_equal '\\\\.\\{some-device-name#abcd}', r[1]
835
- assert_equal :form_6, r[1].form
836
- assert_equal '\\abc/', r[2]
837
- assert_equal 'file.ext', r[3]
838
- assert_equal 'file', r[4]
839
- assert_equal '.ext', r[5]
840
- assert_kind_of ::Array, r[6]
841
- assert_equal [ '\\', 'abc/' ], r[6]
842
- assert_kind_of ::Array, r[7]
843
- assert_equal [ '\\\\.\\{some-device-name#abcd}\\', 'abc/' ], r[7]
844
- end
845
-
846
- def test_paths_with_invalid_UNC
847
-
848
- r = F.split_path '\\\\?\\server'
849
-
850
- assert_kind_of ::Array, r
851
- assert_equal 8, r.size
852
- assert_equal '\\\\?\\server', r[0]
853
- assert_equal '\\\\?\\server', r[1]
854
- assert_equal :malformed, r[1].form
855
- assert_nil r[2]
856
- assert_nil r[3]
857
- assert_nil r[4]
858
- assert_nil r[5]
859
- assert_kind_of ::Array, r[6]
860
- assert_empty r[6]
861
- assert_kind_of ::Array, r[7]
862
- assert_empty r[7]
863
-
864
- r = F.split_path '\\\\?\\server\\'
865
-
866
- assert_kind_of ::Array, r
867
- assert_equal 8, r.size
868
- assert_equal '\\\\?\\server\\', r[0]
869
- assert_equal '\\\\?\\server\\', r[1]
870
- assert_equal :malformed, r[1].form
871
- assert_nil r[2]
872
- assert_nil r[3]
873
- assert_nil r[4]
874
- assert_nil r[5]
875
- assert_kind_of ::Array, r[6]
876
- assert_empty r[6]
877
- assert_kind_of ::Array, r[7]
878
- assert_empty r[7]
879
- end
13
+ F = ::LibPath::Internal_::Windows::Form
14
+
15
+ def test_empty
16
+
17
+ r = F.split_path ''
18
+
19
+ assert_kind_of ::Array, r
20
+ assert_equal 8, r.size
21
+ assert_nil r[0]
22
+ assert_nil r[1]
23
+ assert_nil r[2]
24
+ assert_nil r[3]
25
+ assert_nil r[4]
26
+ assert_nil r[5]
27
+ assert_kind_of ::Array, r[6]
28
+ assert_empty r[6]
29
+ assert_kind_of ::Array, r[7]
30
+ assert_empty r[7]
31
+ end
32
+
33
+ def test_dot
34
+
35
+ r = F.split_path '.'
36
+
37
+ assert_kind_of ::Array, r
38
+ assert_equal 8, r.size
39
+ assert_equal '.', r[0]
40
+ assert_nil r[1]
41
+ assert_nil r[2]
42
+ assert_equal '.', r[3]
43
+ assert_equal '.', r[4]
44
+ assert_nil r[5]
45
+ assert_kind_of ::Array, r[6]
46
+ assert_empty r[6]
47
+ assert_kind_of ::Array, r[7]
48
+ assert_empty r[7]
49
+ end
50
+
51
+ def test_dots
52
+
53
+ r = F.split_path '..'
54
+
55
+ assert_kind_of ::Array, r
56
+ assert_equal 8, r.size
57
+ assert_equal '..', r[0]
58
+ assert_nil r[1]
59
+ assert_nil r[2]
60
+ assert_equal '..', r[3]
61
+ assert_equal '..', r[4]
62
+ assert_nil r[5]
63
+ assert_kind_of ::Array, r[6]
64
+ assert_empty r[6]
65
+ assert_kind_of ::Array, r[7]
66
+ assert_empty r[7]
67
+ end
68
+
69
+ def test_stems
70
+
71
+ r = F.split_path 'a'
72
+
73
+ assert_kind_of ::Array, r
74
+ assert_equal 8, r.size
75
+ assert_equal 'a', r[0]
76
+ assert_nil r[1]
77
+ assert_nil r[2]
78
+ assert_equal 'a', r[3]
79
+ assert_equal 'a', r[4]
80
+ assert_nil r[5]
81
+ assert_kind_of ::Array, r[6]
82
+ assert_empty r[6]
83
+ assert_kind_of ::Array, r[7]
84
+ assert_empty r[7]
85
+
86
+ r = F.split_path 'abc'
87
+
88
+ assert_kind_of ::Array, r
89
+ assert_equal 8, r.size
90
+ assert_equal 'abc', r[0]
91
+ assert_nil r[1]
92
+ assert_nil r[2]
93
+ assert_equal 'abc', r[3]
94
+ assert_equal 'abc', r[4]
95
+ assert_nil r[5]
96
+ assert_kind_of ::Array, r[6]
97
+ assert_empty r[6]
98
+ assert_kind_of ::Array, r[7]
99
+ assert_empty r[7]
100
+
101
+ r = F.split_path 'abcdefghi'
102
+
103
+ assert_kind_of ::Array, r
104
+ assert_equal 8, r.size
105
+ assert_equal 'abcdefghi', r[0]
106
+ assert_nil r[1]
107
+ assert_nil r[2]
108
+ assert_equal 'abcdefghi', r[3]
109
+ assert_equal 'abcdefghi', r[4]
110
+ assert_nil r[5]
111
+ assert_kind_of ::Array, r[6]
112
+ assert_empty r[6]
113
+ assert_kind_of ::Array, r[7]
114
+ assert_empty r[7]
115
+ end
116
+
117
+ def test_basenames
118
+
119
+ r = F.split_path 'a.x'
120
+
121
+ assert_kind_of ::Array, r
122
+ assert_equal 8, r.size
123
+ assert_equal 'a.x', r[0]
124
+ assert_nil r[1]
125
+ assert_nil r[2]
126
+ assert_equal 'a.x', r[3]
127
+ assert_equal 'a', r[4]
128
+ assert_equal '.x', r[5]
129
+ assert_kind_of ::Array, r[6]
130
+ assert_empty r[6]
131
+ assert_kind_of ::Array, r[7]
132
+ assert_empty r[7]
133
+
134
+ r = F.split_path 'abc.ext'
135
+
136
+ assert_kind_of ::Array, r
137
+ assert_equal 8, r.size
138
+ assert_equal 'abc.ext', r[0]
139
+ assert_nil r[1]
140
+ assert_nil r[2]
141
+ assert_equal 'abc.ext', r[3]
142
+ assert_equal 'abc', r[4]
143
+ assert_equal '.ext', r[5]
144
+ assert_kind_of ::Array, r[6]
145
+ assert_empty r[6]
146
+ assert_kind_of ::Array, r[7]
147
+ assert_empty r[7]
148
+
149
+ r = F.split_path 'abcd.efghi.ext'
150
+
151
+ assert_kind_of ::Array, r
152
+ assert_equal 8, r.size
153
+ assert_nil r[1]
154
+ assert_nil r[2]
155
+ assert_equal 'abcd.efghi.ext', r[3]
156
+ assert_equal 'abcd.efghi', r[4]
157
+ assert_equal '.ext', r[5]
158
+ assert_kind_of ::Array, r[6]
159
+ assert_empty r[6]
160
+ assert_kind_of ::Array, r[7]
161
+ assert_empty r[7]
162
+ end
163
+
164
+ def test_directories
165
+
166
+ r = F.split_path 'a/'
167
+
168
+ assert_kind_of ::Array, r
169
+ assert_equal 8, r.size
170
+ assert_equal 'a/', r[0]
171
+ assert_nil r[1]
172
+ assert_equal 'a/', r[2]
173
+ assert_nil r[3]
174
+ assert_nil r[4]
175
+ assert_nil r[5]
176
+ assert_kind_of ::Array, r[6]
177
+ assert_equal [ 'a/' ], r[6]
178
+ assert_kind_of ::Array, r[7]
179
+ assert_equal [ 'a/' ], r[7]
180
+
181
+ r = F.split_path 'a\\'
182
+
183
+ assert_kind_of ::Array, r
184
+ assert_equal 8, r.size
185
+ assert_equal 'a\\', r[0]
186
+ assert_nil r[1]
187
+ assert_equal 'a\\', r[2]
188
+ assert_nil r[3]
189
+ assert_nil r[4]
190
+ assert_nil r[5]
191
+ assert_kind_of ::Array, r[6]
192
+ assert_equal [ 'a\\' ], r[6]
193
+ assert_kind_of ::Array, r[7]
194
+ assert_equal [ 'a\\' ], r[7]
195
+
196
+ r = F.split_path 'abc/'
197
+
198
+ assert_kind_of ::Array, r
199
+ assert_equal 8, r.size
200
+ assert_equal 'abc/', r[0]
201
+ assert_nil r[1]
202
+ assert_equal 'abc/', r[2]
203
+ assert_nil r[3]
204
+ assert_nil r[4]
205
+ assert_nil r[5]
206
+ assert_kind_of ::Array, r[6]
207
+ assert_equal [ 'abc/' ], r[6]
208
+ assert_kind_of ::Array, r[7]
209
+ assert_equal [ 'abc/' ], r[7]
210
+
211
+ r = F.split_path 'abc\\'
212
+
213
+ assert_kind_of ::Array, r
214
+ assert_equal 8, r.size
215
+ assert_equal 'abc\\', r[0]
216
+ assert_nil r[1]
217
+ assert_equal 'abc\\', r[2]
218
+ assert_nil r[3]
219
+ assert_nil r[4]
220
+ assert_nil r[5]
221
+ assert_kind_of ::Array, r[6]
222
+ assert_equal [ 'abc\\' ], r[6]
223
+ assert_kind_of ::Array, r[7]
224
+ assert_equal [ 'abc\\' ], r[7]
225
+
226
+ r = F.split_path 'abc/def/'
227
+
228
+ assert_kind_of ::Array, r
229
+ assert_equal 8, r.size
230
+ assert_equal 'abc/def/', r[0]
231
+ assert_nil r[1]
232
+ assert_equal 'abc/def/', r[2]
233
+ assert_nil r[3]
234
+ assert_nil r[4]
235
+ assert_nil r[5]
236
+ assert_kind_of ::Array, r[6]
237
+ assert_equal [ 'abc/', 'def/' ], r[6]
238
+ assert_kind_of ::Array, r[7]
239
+ assert_equal [ 'abc/', 'def/' ], r[7]
240
+
241
+ r = F.split_path 'abc\\def\\'
242
+
243
+ assert_kind_of ::Array, r
244
+ assert_equal 8, r.size
245
+ assert_equal 'abc\\def\\', r[0]
246
+ assert_nil r[1]
247
+ assert_equal 'abc\\def\\', r[2]
248
+ assert_nil r[3]
249
+ assert_nil r[4]
250
+ assert_nil r[5]
251
+ assert_kind_of ::Array, r[6]
252
+ assert_equal [ 'abc\\', 'def\\' ], r[6]
253
+ assert_kind_of ::Array, r[7]
254
+ assert_equal [ 'abc\\', 'def\\' ], r[7]
255
+
256
+ r = F.split_path '/'
257
+
258
+ assert_kind_of ::Array, r
259
+ assert_equal 8, r.size
260
+ assert_equal '/', r[0]
261
+ assert_nil r[1]
262
+ assert_equal '/', r[2]
263
+ assert_nil r[3]
264
+ assert_nil r[4]
265
+ assert_nil r[5]
266
+ assert_kind_of ::Array, r[6]
267
+ assert_equal [ '/' ], r[6]
268
+ assert_kind_of ::Array, r[7]
269
+ assert_equal [ '/' ], r[7]
270
+
271
+ r = F.split_path '\\'
272
+
273
+ assert_kind_of ::Array, r
274
+ assert_equal 8, r.size
275
+ assert_equal '\\', r[0]
276
+ assert_nil r[1]
277
+ assert_equal '\\', r[2]
278
+ assert_nil r[3]
279
+ assert_nil r[4]
280
+ assert_nil r[5]
281
+ assert_kind_of ::Array, r[6]
282
+ assert_equal [ '\\' ], r[6]
283
+ assert_kind_of ::Array, r[7]
284
+ assert_equal [ '\\' ], r[7]
285
+
286
+ r = F.split_path '/abc/'
287
+
288
+ assert_kind_of ::Array, r
289
+ assert_equal 8, r.size
290
+ assert_equal '/abc/', r[0]
291
+ assert_nil r[1]
292
+ assert_equal '/abc/', r[2]
293
+ assert_nil r[3]
294
+ assert_nil r[4]
295
+ assert_nil r[5]
296
+ assert_kind_of ::Array, r[6]
297
+ assert_equal [ '/', 'abc/' ], r[6]
298
+ assert_kind_of ::Array, r[7]
299
+ assert_equal [ '/', 'abc/' ], r[7]
300
+
301
+ r = F.split_path '\\abc\\'
302
+
303
+ assert_kind_of ::Array, r
304
+ assert_equal 8, r.size
305
+ assert_equal '\\abc\\', r[0]
306
+ assert_nil r[1]
307
+ assert_equal '\\abc\\', r[2]
308
+ assert_nil r[3]
309
+ assert_nil r[4]
310
+ assert_nil r[5]
311
+ assert_kind_of ::Array, r[6]
312
+ assert_equal [ '\\', 'abc\\' ], r[6]
313
+ assert_kind_of ::Array, r[7]
314
+ assert_equal [ '\\', 'abc\\' ], r[7]
315
+
316
+ r = F.split_path '/abc/def/'
317
+
318
+ assert_kind_of ::Array, r
319
+ assert_equal 8, r.size
320
+ assert_equal '/abc/def/', r[0]
321
+ assert_nil r[1]
322
+ assert_equal '/abc/def/', r[2]
323
+ assert_nil r[3]
324
+ assert_nil r[4]
325
+ assert_nil r[5]
326
+ assert_kind_of ::Array, r[6]
327
+ assert_equal [ '/', 'abc/', 'def/' ], r[6]
328
+ assert_kind_of ::Array, r[7]
329
+ assert_equal [ '/', 'abc/', 'def/' ], r[7]
330
+
331
+ r = F.split_path '\\abc\\def\\'
332
+
333
+ assert_kind_of ::Array, r
334
+ assert_equal 8, r.size
335
+ assert_equal '\\abc\\def\\', r[0]
336
+ assert_nil r[1]
337
+ assert_equal '\\abc\\def\\', r[2]
338
+ assert_nil r[3]
339
+ assert_nil r[4]
340
+ assert_nil r[5]
341
+ assert_kind_of ::Array, r[6]
342
+ assert_equal [ '\\', 'abc\\', 'def\\' ], r[6]
343
+ assert_kind_of ::Array, r[7]
344
+ assert_equal [ '\\', 'abc\\', 'def\\' ], r[7]
345
+
346
+ r = F.split_path '~/abc/def/'
347
+
348
+ assert_kind_of ::Array, r
349
+ assert_equal 8, r.size
350
+ assert_equal '~/abc/def/', r[0]
351
+ assert_nil r[1]
352
+ assert_equal '~/abc/def/', r[2]
353
+ assert_nil r[3]
354
+ assert_nil r[4]
355
+ assert_nil r[5]
356
+ assert_kind_of ::Array, r[6]
357
+ assert_equal [ '~/', 'abc/', 'def/' ], r[6]
358
+ assert_kind_of ::Array, r[7]
359
+ assert_equal [ '~/', 'abc/', 'def/' ], r[7]
360
+
361
+ r = F.split_path '~\\abc\\def\\'
362
+
363
+ assert_kind_of ::Array, r
364
+ assert_equal 8, r.size
365
+ assert_equal '~\\abc\\def\\', r[0]
366
+ assert_nil r[1]
367
+ assert_equal '~\\abc\\def\\', r[2]
368
+ assert_nil r[3]
369
+ assert_nil r[4]
370
+ assert_nil r[5]
371
+ assert_kind_of ::Array, r[6]
372
+ assert_equal [ '~\\', 'abc\\', 'def\\' ], r[6]
373
+ assert_kind_of ::Array, r[7]
374
+ assert_equal [ '~\\', 'abc\\', 'def\\' ], r[7]
375
+
376
+ r = F.split_path '~/abc\\def/'
377
+
378
+ assert_kind_of ::Array, r
379
+ assert_equal 8, r.size
380
+ assert_equal '~/abc\\def/', r[0]
381
+ assert_nil r[1]
382
+ assert_equal '~/abc\\def/', r[2]
383
+ assert_nil r[3]
384
+ assert_nil r[4]
385
+ assert_nil r[5]
386
+ assert_kind_of ::Array, r[6]
387
+ assert_equal [ '~/', 'abc\\', 'def/' ], r[6]
388
+ assert_kind_of ::Array, r[7]
389
+ assert_equal [ '~/', 'abc\\', 'def/' ], r[7]
390
+ end
391
+
392
+ def test_paths
393
+
394
+ r = F.split_path 'a/b'
395
+
396
+ assert_kind_of ::Array, r
397
+ assert_equal 8, r.size
398
+ assert_equal 'a/b', r[0]
399
+ assert_nil r[1]
400
+ assert_equal 'a/', r[2]
401
+ assert_equal 'b', r[3]
402
+ assert_equal 'b', r[4]
403
+ assert_nil r[5]
404
+ assert_kind_of ::Array, r[6]
405
+ assert_equal [ 'a/' ], r[6]
406
+ assert_kind_of ::Array, r[7]
407
+ assert_equal [ 'a/' ], r[7]
408
+
409
+ r = F.split_path 'a\\b'
410
+
411
+ assert_kind_of ::Array, r
412
+ assert_equal 8, r.size
413
+ assert_equal 'a\\b', r[0]
414
+ assert_nil r[1]
415
+ assert_equal 'a\\', r[2]
416
+ assert_equal 'b', r[3]
417
+ assert_equal 'b', r[4]
418
+ assert_nil r[5]
419
+ assert_kind_of ::Array, r[6]
420
+ assert_equal [ 'a\\' ], r[6]
421
+ assert_kind_of ::Array, r[7]
422
+ assert_equal [ 'a\\' ], r[7]
423
+
424
+ r = F.split_path 'abc/file.ext'
425
+
426
+ assert_kind_of ::Array, r
427
+ assert_equal 8, r.size
428
+ assert_equal 'abc/file.ext', r[0]
429
+ assert_nil r[1]
430
+ assert_equal 'abc/', r[2]
431
+ assert_equal 'file.ext', r[3]
432
+ assert_equal 'file', r[4]
433
+ assert_equal '.ext', r[5]
434
+ assert_kind_of ::Array, r[6]
435
+ assert_equal [ 'abc/' ], r[6]
436
+ assert_kind_of ::Array, r[7]
437
+ assert_equal [ 'abc/' ], r[7]
438
+
439
+ r = F.split_path 'abc\\file.ext'
440
+
441
+ assert_kind_of ::Array, r
442
+ assert_equal 8, r.size
443
+ assert_equal 'abc\\file.ext', r[0]
444
+ assert_nil r[1]
445
+ assert_equal 'abc\\', r[2]
446
+ assert_equal 'file.ext', r[3]
447
+ assert_equal 'file', r[4]
448
+ assert_equal '.ext', r[5]
449
+ assert_kind_of ::Array, r[6]
450
+ assert_equal [ 'abc\\' ], r[6]
451
+ assert_kind_of ::Array, r[7]
452
+ assert_equal [ 'abc\\' ], r[7]
453
+
454
+ r = F.split_path '/abc/file.ext'
455
+
456
+ assert_kind_of ::Array, r
457
+ assert_equal 8, r.size
458
+ assert_equal '/abc/file.ext', r[0]
459
+ assert_nil r[1]
460
+ assert_equal '/abc/', r[2]
461
+ assert_equal 'file.ext', r[3]
462
+ assert_equal 'file', r[4]
463
+ assert_equal '.ext', r[5]
464
+ assert_kind_of ::Array, r[6]
465
+ assert_equal [ '/', 'abc/' ], r[6]
466
+ assert_kind_of ::Array, r[7]
467
+ assert_equal [ '/', 'abc/' ], r[7]
468
+
469
+ r = F.split_path '\\abc\\file.ext'
470
+
471
+ assert_kind_of ::Array, r
472
+ assert_equal 8, r.size
473
+ assert_equal '\\abc\\file.ext', r[0]
474
+ assert_nil r[1]
475
+ assert_equal '\\abc\\', r[2]
476
+ assert_equal 'file.ext', r[3]
477
+ assert_equal 'file', r[4]
478
+ assert_equal '.ext', r[5]
479
+ assert_kind_of ::Array, r[6]
480
+ assert_equal [ '\\', 'abc\\' ], r[6]
481
+ assert_kind_of ::Array, r[7]
482
+ assert_equal [ '\\', 'abc\\' ], r[7]
483
+
484
+ r = F.split_path '/abc/.ext'
485
+
486
+ assert_kind_of ::Array, r
487
+ assert_equal 8, r.size
488
+ assert_equal '/abc/.ext', r[0]
489
+ assert_nil r[1]
490
+ assert_equal '/abc/', r[2]
491
+ assert_equal '.ext', r[3]
492
+ assert_nil r[4]
493
+ assert_equal '.ext', r[5]
494
+ assert_kind_of ::Array, r[6]
495
+ assert_equal [ '/', 'abc/' ], r[6]
496
+ assert_kind_of ::Array, r[7]
497
+ assert_equal [ '/', 'abc/' ], r[7]
498
+
499
+ r = F.split_path '\\abc\\.ext'
500
+
501
+ assert_kind_of ::Array, r
502
+ assert_equal 8, r.size
503
+ assert_equal '\\abc\\.ext', r[0]
504
+ assert_nil r[1]
505
+ assert_equal '\\abc\\', r[2]
506
+ assert_equal '.ext', r[3]
507
+ assert_nil r[4]
508
+ assert_equal '.ext', r[5]
509
+ assert_kind_of ::Array, r[6]
510
+ assert_equal [ '\\', 'abc\\' ], r[6]
511
+ assert_kind_of ::Array, r[7]
512
+ assert_equal [ '\\', 'abc\\' ], r[7]
513
+
514
+ r = F.split_path '/abc/ext.'
515
+
516
+ assert_kind_of ::Array, r
517
+ assert_equal 8, r.size
518
+ assert_equal '/abc/ext.', r[0]
519
+ assert_nil r[1]
520
+ assert_equal '/abc/', r[2]
521
+ assert_equal 'ext.', r[3]
522
+ assert_equal 'ext', r[4]
523
+ assert_equal '.', r[5]
524
+ assert_kind_of ::Array, r[6]
525
+ assert_equal [ '/', 'abc/' ], r[6]
526
+ assert_kind_of ::Array, r[7]
527
+ assert_equal [ '/', 'abc/' ], r[7]
528
+
529
+ r = F.split_path '\\abc\\ext.'
530
+
531
+ assert_kind_of ::Array, r
532
+ assert_equal 8, r.size
533
+ assert_equal '\\abc\\ext.', r[0]
534
+ assert_nil r[1]
535
+ assert_equal '\\abc\\', r[2]
536
+ assert_equal 'ext.', r[3]
537
+ assert_equal 'ext', r[4]
538
+ assert_equal '.', r[5]
539
+ assert_kind_of ::Array, r[6]
540
+ assert_equal [ '\\', 'abc\\' ], r[6]
541
+ assert_kind_of ::Array, r[7]
542
+ assert_equal [ '\\', 'abc\\' ], r[7]
543
+ end
544
+
545
+ def test_paths_with_dots_basenames
546
+
547
+ r = F.split_path '/.'
548
+
549
+ assert_kind_of ::Array, r
550
+ assert_equal 8, r.size
551
+ assert_equal '/.', r[0]
552
+ assert_nil r[1]
553
+ assert_equal '/', r[2]
554
+ assert_equal '.', r[3]
555
+ assert_equal '.', r[4]
556
+ assert_nil r[5]
557
+ assert_kind_of ::Array, r[6]
558
+ assert_equal [ '/' ], r[6]
559
+ assert_kind_of ::Array, r[7]
560
+ assert_equal [ '/' ], r[7]
561
+
562
+ r = F.split_path '\\.'
563
+
564
+ assert_kind_of ::Array, r
565
+ assert_equal 8, r.size
566
+ assert_equal '\\.', r[0]
567
+ assert_nil r[1]
568
+ assert_equal '\\', r[2]
569
+ assert_equal '.', r[3]
570
+ assert_equal '.', r[4]
571
+ assert_nil r[5]
572
+ assert_kind_of ::Array, r[6]
573
+ assert_equal [ '\\' ], r[6]
574
+ assert_kind_of ::Array, r[7]
575
+ assert_equal [ '\\' ], r[7]
576
+
577
+ r = F.split_path '/..'
578
+
579
+ assert_kind_of ::Array, r
580
+ assert_equal 8, r.size
581
+ assert_equal '/..', r[0]
582
+ assert_nil r[1]
583
+ assert_equal '/', r[2]
584
+ assert_equal '..', r[3]
585
+ assert_equal '..', r[4]
586
+ assert_nil r[5]
587
+ assert_kind_of ::Array, r[6]
588
+ assert_equal [ '/' ], r[6]
589
+ assert_kind_of ::Array, r[7]
590
+ assert_equal [ '/' ], r[7]
591
+
592
+ r = F.split_path '\\..'
593
+
594
+ assert_kind_of ::Array, r
595
+ assert_equal 8, r.size
596
+ assert_equal '\\..', r[0]
597
+ assert_nil r[1]
598
+ assert_equal '\\', r[2]
599
+ assert_equal '..', r[3]
600
+ assert_equal '..', r[4]
601
+ assert_nil r[5]
602
+ assert_kind_of ::Array, r[6]
603
+ assert_equal [ '\\' ], r[6]
604
+ assert_kind_of ::Array, r[7]
605
+ assert_equal [ '\\' ], r[7]
606
+
607
+ r = F.split_path './..'
608
+
609
+ assert_kind_of ::Array, r
610
+ assert_equal 8, r.size
611
+ assert_equal './..', r[0]
612
+ assert_nil r[1]
613
+ assert_equal './', r[2]
614
+ assert_equal '..', r[3]
615
+ assert_equal '..', r[4]
616
+ assert_nil r[5]
617
+ assert_kind_of ::Array, r[6]
618
+ assert_equal [ './' ], r[6]
619
+ assert_kind_of ::Array, r[7]
620
+ assert_equal [ './' ], r[7]
621
+
622
+ r = F.split_path '.\\..'
623
+
624
+ assert_kind_of ::Array, r
625
+ assert_equal 8, r.size
626
+ assert_equal '.\\..', r[0]
627
+ assert_nil r[1]
628
+ assert_equal '.\\', r[2]
629
+ assert_equal '..', r[3]
630
+ assert_equal '..', r[4]
631
+ assert_nil r[5]
632
+ assert_kind_of ::Array, r[6]
633
+ assert_equal [ '.\\' ], r[6]
634
+ assert_kind_of ::Array, r[7]
635
+ assert_equal [ '.\\' ], r[7]
636
+ end
637
+
638
+ def test_paths_with_drives_form1
639
+
640
+ r = F.split_path 'C:/abc/file.ext'
641
+
642
+ assert_kind_of ::Array, r
643
+ assert_equal 8, r.size
644
+ assert_equal 'C:/abc/file.ext', r[0]
645
+ assert_equal 'C:', r[1]
646
+ assert_equal :form_1, r[1].form
647
+ assert_equal '/abc/', r[2]
648
+ assert_equal 'file.ext', r[3]
649
+ assert_equal 'file', r[4]
650
+ assert_equal '.ext', r[5]
651
+ assert_kind_of ::Array, r[6]
652
+ assert_equal [ '/', 'abc/' ], r[6]
653
+ assert_kind_of ::Array, r[7]
654
+ assert_equal [ 'C:/', 'abc/' ], r[7]
655
+
656
+ r = F.split_path 'C:\\abc\\file.ext'
657
+
658
+ assert_kind_of ::Array, r
659
+ assert_equal 8, r.size
660
+ assert_equal 'C:\\abc\\file.ext', r[0]
661
+ assert_equal 'C:', r[1]
662
+ assert_equal :form_1, r[1].form
663
+ assert_equal '\\abc\\', r[2]
664
+ assert_equal 'file.ext', r[3]
665
+ assert_equal 'file', r[4]
666
+ assert_equal '.ext', r[5]
667
+ assert_kind_of ::Array, r[6]
668
+ assert_equal [ '\\', 'abc\\' ], r[6]
669
+ assert_kind_of ::Array, r[7]
670
+ assert_equal [ 'C:\\', 'abc\\' ], r[7]
671
+ end
672
+
673
+ def test_paths_with_drives_form3
674
+
675
+ r = F.split_path '\\\\?\\d:/abc/file.ext'
676
+
677
+ assert_kind_of ::Array, r
678
+ assert_equal 8, r.size
679
+ assert_equal '\\\\?\\d:/abc/file.ext', r[0]
680
+ assert_equal '\\\\?\\d:', r[1]
681
+ assert_equal :form_3, r[1].form
682
+ assert_equal '/abc/', r[2]
683
+ assert_equal 'file.ext', r[3]
684
+ assert_equal 'file', r[4]
685
+ assert_equal '.ext', r[5]
686
+ assert_kind_of ::Array, r[6]
687
+ assert_equal [ '/', 'abc/' ], r[6]
688
+ assert_kind_of ::Array, r[7]
689
+ assert_equal [ '\\\\?\\d:/', 'abc/' ], r[7]
690
+
691
+ r = F.split_path '\\\\?\\d:\\abc\\file.ext'
692
+
693
+ assert_kind_of ::Array, r
694
+ assert_equal 8, r.size
695
+ assert_equal '\\\\?\\d:\\abc\\file.ext', r[0]
696
+ assert_equal '\\\\?\\d:', r[1]
697
+ assert_equal :form_3, r[1].form
698
+ assert_equal '\\abc\\', r[2]
699
+ assert_equal 'file.ext', r[3]
700
+ assert_equal 'file', r[4]
701
+ assert_equal '.ext', r[5]
702
+ assert_kind_of ::Array, r[6]
703
+ assert_equal [ '\\', 'abc\\' ], r[6]
704
+ assert_kind_of ::Array, r[7]
705
+ assert_equal [ '\\\\?\\d:\\', 'abc\\' ], r[7]
706
+ end
707
+
708
+ def test_paths_with_UNC_form2
709
+
710
+ r = F.split_path '\\\\101.202.303.404:1234\\some-share-or-other\\abc\\file.ext'
711
+
712
+ assert_kind_of ::Array, r
713
+ assert_equal 8, r.size
714
+ assert_equal '\\\\101.202.303.404:1234\\some-share-or-other\\abc\\file.ext', r[0]
715
+ assert_equal '\\\\101.202.303.404:1234\\some-share-or-other', r[1]
716
+ assert_equal :form_2, r[1].form
717
+ assert_equal '\\abc\\', r[2]
718
+ assert_equal 'file.ext', r[3]
719
+ assert_equal 'file', r[4]
720
+ assert_equal '.ext', r[5]
721
+ assert_kind_of ::Array, r[6]
722
+ assert_equal [ '\\', 'abc\\' ], r[6]
723
+ assert_kind_of ::Array, r[7]
724
+ assert_equal [ '\\\\101.202.303.404:1234\\some-share-or-other\\', 'abc\\' ], r[7]
725
+
726
+ r = F.split_path '\\\\101.202.303.404:1234\\some-share-or-other\\abc/file.ext'
727
+
728
+ assert_kind_of ::Array, r
729
+ assert_equal 8, r.size
730
+ assert_equal '\\\\101.202.303.404:1234\\some-share-or-other\\abc/file.ext', r[0]
731
+ assert_equal '\\\\101.202.303.404:1234\\some-share-or-other', r[1]
732
+ assert_equal :form_2, r[1].form
733
+ assert_equal '\\abc/', r[2]
734
+ assert_equal 'file.ext', r[3]
735
+ assert_equal 'file', r[4]
736
+ assert_equal '.ext', r[5]
737
+ assert_kind_of ::Array, r[6]
738
+ assert_equal [ '\\', 'abc/' ], r[6]
739
+ assert_kind_of ::Array, r[7]
740
+ assert_equal [ '\\\\101.202.303.404:1234\\some-share-or-other\\', 'abc/' ], r[7]
741
+ end
742
+
743
+ def test_paths_with_UNC_form4
744
+
745
+ r = F.split_path '\\\\?\\101.202.303.404:1234\\some-share-or-other\\abc\\file.ext'
746
+
747
+ assert_kind_of ::Array, r
748
+ assert_equal 8, r.size
749
+ assert_equal '\\\\?\\101.202.303.404:1234\\some-share-or-other\\abc\\file.ext', r[0]
750
+ assert_equal '\\\\?\\101.202.303.404:1234\\some-share-or-other', r[1]
751
+ assert_equal :form_4, r[1].form
752
+ assert_equal '\\abc\\', r[2]
753
+ assert_equal 'file.ext', r[3]
754
+ assert_equal 'file', r[4]
755
+ assert_equal '.ext', r[5]
756
+ assert_kind_of ::Array, r[6]
757
+ assert_equal [ '\\', 'abc\\' ], r[6]
758
+ assert_kind_of ::Array, r[7]
759
+ assert_equal [ '\\\\?\\101.202.303.404:1234\\some-share-or-other\\', 'abc\\' ], r[7]
760
+
761
+ r = F.split_path '\\\\?\\101.202.303.404:1234\\some-share-or-other\\abc/file.ext'
762
+
763
+ assert_kind_of ::Array, r
764
+ assert_equal 8, r.size
765
+ assert_equal '\\\\?\\101.202.303.404:1234\\some-share-or-other\\abc/file.ext', r[0]
766
+ assert_equal '\\\\?\\101.202.303.404:1234\\some-share-or-other', r[1]
767
+ assert_equal :form_4, r[1].form
768
+ assert_equal '\\abc/', r[2]
769
+ assert_equal 'file.ext', r[3]
770
+ assert_equal 'file', r[4]
771
+ assert_equal '.ext', r[5]
772
+ assert_kind_of ::Array, r[6]
773
+ assert_equal [ '\\', 'abc/' ], r[6]
774
+ assert_kind_of ::Array, r[7]
775
+ assert_equal [ '\\\\?\\101.202.303.404:1234\\some-share-or-other\\', 'abc/' ], r[7]
776
+ end
777
+
778
+ def test_paths_with_UNC_form5
779
+
780
+ r = F.split_path '\\\\?\\UNC\\101.202.303.404:1234\\some-share-or-other\\abc\\file.ext'
781
+
782
+ assert_kind_of ::Array, r
783
+ assert_equal 8, r.size
784
+ assert_equal '\\\\?\\UNC\\101.202.303.404:1234\\some-share-or-other\\abc\\file.ext', r[0]
785
+ assert_equal '\\\\?\\UNC\\101.202.303.404:1234\\some-share-or-other', r[1]
786
+ assert_equal :form_5, r[1].form
787
+ assert_equal '\\abc\\', r[2]
788
+ assert_equal 'file.ext', r[3]
789
+ assert_equal 'file', r[4]
790
+ assert_equal '.ext', r[5]
791
+ assert_kind_of ::Array, r[6]
792
+ assert_equal [ '\\', 'abc\\' ], r[6]
793
+ assert_kind_of ::Array, r[7]
794
+ assert_equal [ '\\\\?\\UNC\\101.202.303.404:1234\\some-share-or-other\\', 'abc\\' ], r[7]
795
+
796
+ r = F.split_path '\\\\?\\UNC\\101.202.303.404:1234\\some-share-or-other\\abc/file.ext'
797
+
798
+ assert_kind_of ::Array, r
799
+ assert_equal 8, r.size
800
+ assert_equal '\\\\?\\UNC\\101.202.303.404:1234\\some-share-or-other\\abc/file.ext', r[0]
801
+ assert_equal '\\\\?\\UNC\\101.202.303.404:1234\\some-share-or-other', r[1]
802
+ assert_equal :form_5, r[1].form
803
+ assert_equal '\\abc/', r[2]
804
+ assert_equal 'file.ext', r[3]
805
+ assert_equal 'file', r[4]
806
+ assert_equal '.ext', r[5]
807
+ assert_kind_of ::Array, r[6]
808
+ assert_equal [ '\\', 'abc/' ], r[6]
809
+ assert_kind_of ::Array, r[7]
810
+ assert_equal [ '\\\\?\\UNC\\101.202.303.404:1234\\some-share-or-other\\', 'abc/' ], r[7]
811
+ end
812
+
813
+ def test_paths_with_device_form6
814
+
815
+ r = F.split_path '\\\\.\\{some-device-name#abcd}\\abc\\file.ext'
816
+
817
+ assert_kind_of ::Array, r
818
+ assert_equal 8, r.size
819
+ assert_equal '\\\\.\\{some-device-name#abcd}\\abc\\file.ext', r[0]
820
+ assert_equal '\\\\.\\{some-device-name#abcd}', r[1]
821
+ assert_equal :form_6, r[1].form
822
+ assert_equal '\\abc\\', r[2]
823
+ assert_equal 'file.ext', r[3]
824
+ assert_equal 'file', r[4]
825
+ assert_equal '.ext', r[5]
826
+ assert_kind_of ::Array, r[6]
827
+ assert_equal [ '\\', 'abc\\' ], r[6]
828
+ assert_kind_of ::Array, r[7]
829
+ assert_equal [ '\\\\.\\{some-device-name#abcd}\\', 'abc\\' ], r[7]
830
+
831
+ r = F.split_path '\\\\.\\{some-device-name#abcd}\\abc/file.ext'
832
+
833
+ assert_kind_of ::Array, r
834
+ assert_equal 8, r.size
835
+ assert_equal '\\\\.\\{some-device-name#abcd}\\abc/file.ext', r[0]
836
+ assert_equal '\\\\.\\{some-device-name#abcd}', r[1]
837
+ assert_equal :form_6, r[1].form
838
+ assert_equal '\\abc/', r[2]
839
+ assert_equal 'file.ext', r[3]
840
+ assert_equal 'file', r[4]
841
+ assert_equal '.ext', r[5]
842
+ assert_kind_of ::Array, r[6]
843
+ assert_equal [ '\\', 'abc/' ], r[6]
844
+ assert_kind_of ::Array, r[7]
845
+ assert_equal [ '\\\\.\\{some-device-name#abcd}\\', 'abc/' ], r[7]
846
+ end
847
+
848
+ def test_paths_with_invalid_UNC
849
+
850
+ r = F.split_path '\\\\?\\server'
851
+
852
+ assert_kind_of ::Array, r
853
+ assert_equal 8, r.size
854
+ assert_equal '\\\\?\\server', r[0]
855
+ assert_equal '\\\\?\\server', r[1]
856
+ assert_equal :malformed, r[1].form
857
+ assert_nil r[2]
858
+ assert_nil r[3]
859
+ assert_nil r[4]
860
+ assert_nil r[5]
861
+ assert_kind_of ::Array, r[6]
862
+ assert_empty r[6]
863
+ assert_kind_of ::Array, r[7]
864
+ assert_empty r[7]
865
+
866
+ r = F.split_path '\\\\?\\server\\'
867
+
868
+ assert_kind_of ::Array, r
869
+ assert_equal 8, r.size
870
+ assert_equal '\\\\?\\server\\', r[0]
871
+ assert_equal '\\\\?\\server\\', r[1]
872
+ assert_equal :malformed, r[1].form
873
+ assert_nil r[2]
874
+ assert_nil r[3]
875
+ assert_nil r[4]
876
+ assert_nil r[5]
877
+ assert_kind_of ::Array, r[6]
878
+ assert_empty r[6]
879
+ assert_kind_of ::Array, r[7]
880
+ assert_empty r[7]
881
+ end
880
882
  end
881
883
 
884
+
885
+ # ############################## end of file ############################# #
886
+