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.
- checksums.yaml +4 -4
- data/LICENSE +33 -0
- data/README.md +25 -8
- data/examples/path_from_arg0.md +43 -43
- data/examples/path_from_arg0.rb +25 -23
- data/lib/libpath/constants/unix.rb +71 -71
- data/lib/libpath/constants/windows.rb +72 -72
- data/lib/libpath/constants.rb +18 -19
- data/lib/libpath/diagnostics/parameter_checking.rb +25 -25
- data/lib/libpath/diagnostics.rb +1 -1
- data/lib/libpath/exceptions/libpath_base_exception.rb +13 -13
- data/lib/libpath/exceptions/malformed_name_exception.rb +23 -22
- data/lib/libpath/exceptions.rb +3 -3
- data/lib/libpath/form/unix.rb +104 -103
- data/lib/libpath/form/windows.rb +200 -199
- data/lib/libpath/form.rb +18 -18
- data/lib/libpath/internal_/array.rb +53 -53
- data/lib/libpath/internal_/platform.rb +24 -24
- data/lib/libpath/internal_/string.rb +20 -17
- data/lib/libpath/internal_/unix/form.rb +117 -112
- data/lib/libpath/internal_/windows/drive.rb +62 -59
- data/lib/libpath/internal_/windows/form.rb +193 -188
- data/lib/libpath/libpath.rb +3 -0
- data/lib/libpath/path/unix.rb +114 -112
- data/lib/libpath/path/windows.rb +120 -118
- data/lib/libpath/path.rb +18 -20
- data/lib/libpath/util/unix.rb +258 -258
- data/lib/libpath/util/windows.rb +400 -400
- data/lib/libpath/util.rb +18 -19
- data/lib/libpath/version.rb +23 -23
- data/lib/libpath.rb +1 -1
- data/test/performance/benchmark_drive_letter.rb +50 -10
- data/test/performance/benchmark_gsub_string_or_regex.rb +27 -23
- data/test/performance/benchmark_rindex2.rb +56 -48
- data/test/performance/benchmark_split.rb +16 -10
- data/test/unit/compare/ts_all.rb +4 -4
- data/test/unit/equate/ts_all.rb +4 -4
- data/test/unit/equate/unix/ts_all.rb +4 -4
- data/test/unit/equate/windows/ts_all.rb +4 -4
- data/test/unit/exceptions/tc_libpath_base_exception.rb +10 -8
- data/test/unit/exceptions/tc_malformed_name_exception.rb +14 -12
- data/test/unit/exceptions/ts_all.rb +4 -4
- data/test/unit/form/tc_absolute_functions.rb +242 -240
- data/test/unit/form/ts_all.rb +4 -4
- data/test/unit/form/unix/tc_absolute_functions.rb +158 -155
- data/test/unit/form/unix/ts_all.rb +4 -4
- data/test/unit/form/windows/tc_absolute_functions.rb +628 -625
- data/test/unit/form/windows/ts_all.rb +4 -4
- data/test/unit/internal_/tc_array.rb +36 -32
- data/test/unit/internal_/ts_all.rb +4 -4
- data/test/unit/internal_/unix/form/tc_slash_functions.rb +38 -35
- data/test/unit/internal_/unix/form/ts_all.rb +4 -4
- data/test/unit/internal_/unix/tc_split_path.rb +387 -384
- data/test/unit/internal_/unix/ts_all.rb +4 -4
- data/test/unit/internal_/windows/form/tc_get_windows_volume.rb +157 -153
- data/test/unit/internal_/windows/form/tc_slash_functions.rb +39 -35
- data/test/unit/internal_/windows/form/ts_all.rb +4 -4
- data/test/unit/internal_/windows/tc_split_path.rb +874 -869
- data/test/unit/internal_/windows/ts_all.rb +4 -4
- data/test/unit/parse/ts_all.rb +4 -4
- data/test/unit/path/tc_path.rb +732 -732
- data/test/unit/path/ts_all.rb +4 -4
- data/test/unit/path/unix/tc_path.rb +544 -540
- data/test/unit/path/unix/ts_all.rb +4 -4
- data/test/unit/path/windows/tc_path.rb +608 -603
- data/test/unit/path/windows/ts_all.rb +4 -4
- data/test/unit/tc_version.rb +25 -22
- data/test/unit/ts_all.rb +4 -4
- data/test/unit/util/tc_combine_paths.rb +110 -105
- data/test/unit/util/tc_derive_relative_path.rb +8 -3
- data/test/unit/util/tc_make_path_canonical.rb +142 -138
- data/test/unit/util/ts_all.rb +4 -4
- data/test/unit/util/unix/tc_combine_paths.rb +38 -34
- data/test/unit/util/unix/tc_derive_relative_path.rb +80 -75
- data/test/unit/util/unix/tc_make_path_absolute.rb +74 -70
- data/test/unit/util/unix/tc_make_path_canonical.rb +95 -90
- data/test/unit/util/unix/ts_all.rb +4 -4
- data/test/unit/util/windows/tc_combine_paths.rb +82 -77
- data/test/unit/util/windows/tc_derive_relative_path.rb +98 -93
- data/test/unit/util/windows/tc_make_path_absolute.rb +105 -101
- data/test/unit/util/windows/tc_make_path_canonical.rb +158 -153
- data/test/unit/util/windows/ts_all.rb +4 -4
- 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
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
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
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
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
|
+
|