summaryrefslogtreecommitdiff
path: root/dist/Cwd/t/Spec.t
blob: b4339efdf35b6267167ed5ddd9e2574922c94015 (plain)
1
2
3
4
5
6
7
8
9
10
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
#!/usr/bin/perl -w

use Test;

# Grab all of the plain routines from File::Spec
use File::Spec @File::Spec::EXPORT_OK ;

require File::Spec::Unix ;
require File::Spec::Win32 ;
require Cwd;

eval {
   require VMS::Filespec ;
} ;

my $vms_unix_rpt;
my $vms_efs;

if ($^O eq 'VMS') {
    if (eval 'require VMS::Feature') {
        $vms_unix_rpt = VMS::Feature::current("filename_unix_report");
        $vms_efs = VMS::Feature::current("efs_charset");
    } else {
        my $unix_rpt = $ENV{'DECC$FILENAME_UNIX_REPORT'} || '';
        my $efs_charset = $ENV{'DECC$EFS_CHARSET'} || '';
        $vms_unix_rpt = $unix_rpt =~ /^[ET1]/i; 
        $vms_efs = $efs_charset =~ /^[ET1]/i; 
    }
}


my $skip_exception = "Install VMS::Filespec (from vms/ext)" ;

if ( $@ ) {
   # Not pretty, but it allows testing of things not implemented soley
   # on VMS.  It might be better to change File::Spec::VMS to do this,
   # making it more usable when running on (say) Unix but working with
   # VMS paths.
   eval qq-
      sub File::Spec::VMS::vmsify  { die "$skip_exception" }
      sub File::Spec::VMS::unixify { die "$skip_exception" }
      sub File::Spec::VMS::vmspath { die "$skip_exception" }
   - ;
   $INC{"VMS/Filespec.pm"} = 1 ;
}
require File::Spec::VMS ;

require File::Spec::OS2 ;
require File::Spec::Mac ;
require File::Spec::Epoc ;
require File::Spec::Cygwin ;

# $root is only needed by Mac OS tests; these particular
# tests are skipped on other OSs
my $root = '';
if ($^O eq 'MacOS') {
	$root = File::Spec::Mac->rootdir();
}

# Each element in this array is a single test. Storing them this way makes
# maintenance easy, and should be OK since perl should be pretty functional
# before these tests are run.

@tests = (
# [ Function          ,            Expected          ,         Platform ]

[ "Unix->case_tolerant()",         '0'  ],

[ "Unix->catfile('a','b','c')",         'a/b/c'  ],
[ "Unix->catfile('a','b','./c')",       'a/b/c'  ],
[ "Unix->catfile('./a','b','c')",       'a/b/c'  ],
[ "Unix->catfile('c')",                 'c' ],
[ "Unix->catfile('./c')",               'c' ],

[ "Unix->splitpath('file')",            ',,file'            ],
[ "Unix->splitpath('/d1/d2/d3/')",      ',/d1/d2/d3/,'      ],
[ "Unix->splitpath('d1/d2/d3/')",       ',d1/d2/d3/,'       ],
[ "Unix->splitpath('/d1/d2/d3/.')",     ',/d1/d2/d3/.,'     ],
[ "Unix->splitpath('/d1/d2/d3/..')",    ',/d1/d2/d3/..,'    ],
[ "Unix->splitpath('/d1/d2/d3/.file')", ',/d1/d2/d3/,.file' ],
[ "Unix->splitpath('d1/d2/d3/file')",   ',d1/d2/d3/,file'   ],
[ "Unix->splitpath('/../../d1/')",      ',/../../d1/,'      ],
[ "Unix->splitpath('/././d1/')",        ',/././d1/,'        ],

[ "Unix->catpath('','','file')",            'file'            ],
[ "Unix->catpath('','/d1/d2/d3/','')",      '/d1/d2/d3/'      ],
[ "Unix->catpath('','d1/d2/d3/','')",       'd1/d2/d3/'       ],
[ "Unix->catpath('','/d1/d2/d3/.','')",     '/d1/d2/d3/.'     ],
[ "Unix->catpath('','/d1/d2/d3/..','')",    '/d1/d2/d3/..'    ],
[ "Unix->catpath('','/d1/d2/d3/','.file')", '/d1/d2/d3/.file' ],
[ "Unix->catpath('','d1/d2/d3/','file')",   'd1/d2/d3/file'   ],
[ "Unix->catpath('','/../../d1/','')",      '/../../d1/'      ],
[ "Unix->catpath('','/././d1/','')",        '/././d1/'        ],
[ "Unix->catpath('d1','d2/d3/','')",        'd2/d3/'          ],
[ "Unix->catpath('d1','d2','d3/')",         'd2/d3/'          ],

[ "Unix->splitdir('')",           ''           ],
[ "Unix->splitdir('/d1/d2/d3/')", ',d1,d2,d3,' ],
[ "Unix->splitdir('d1/d2/d3/')",  'd1,d2,d3,'  ],
[ "Unix->splitdir('/d1/d2/d3')",  ',d1,d2,d3'  ],
[ "Unix->splitdir('d1/d2/d3')",   'd1,d2,d3'   ],

[ "Unix->catdir()",                     ''          ],
[ "Unix->catdir('')",                   '/'         ],
[ "Unix->catdir('/')",                  '/'         ],
[ "Unix->catdir('','d1','d2','d3','')", '/d1/d2/d3' ],
[ "Unix->catdir('d1','d2','d3','')",    'd1/d2/d3'  ],
[ "Unix->catdir('','d1','d2','d3')",    '/d1/d2/d3' ],
[ "Unix->catdir('d1','d2','d3')",       'd1/d2/d3'  ],
[ "Unix->catdir('/','d2/d3')",          '/d2/d3'    ],

[ "Unix->canonpath('///../../..//./././a//b/.././c/././')",   '/a/b/../c' ],
[ "Unix->canonpath('')",                       ''               ],
# rt.perl.org 27052
[ "Unix->canonpath('a/../../b/c')",            'a/../../b/c'    ],
[ "Unix->canonpath('/.')",                     '/'              ],
[ "Unix->canonpath('/./')",                    '/'              ],
[ "Unix->canonpath('/a/./')",                  '/a'             ],
[ "Unix->canonpath('/a/.')",                   '/a'             ],
[ "Unix->canonpath('/../../')",                '/'              ],
[ "Unix->canonpath('/../..')",                 '/'              ],

[  "Unix->abs2rel('/t1/t2/t3','/t1/t2/t3')",          '.'                  ],
[  "Unix->abs2rel('/t1/t2/t4','/t1/t2/t3')",          '../t4'              ],
[  "Unix->abs2rel('/t1/t2','/t1/t2/t3')",             '..'                 ],
[  "Unix->abs2rel('/t1/t2/t3/t4','/t1/t2/t3')",       't4'                 ],
[  "Unix->abs2rel('/t4/t5/t6','/t1/t2/t3')",          '../../../t4/t5/t6'  ],
#[ "Unix->abs2rel('../t4','/t1/t2/t3')",              '../t4'              ],
[  "Unix->abs2rel('/','/t1/t2/t3')",                  '../../..'           ],
[  "Unix->abs2rel('///','/t1/t2/t3')",                '../../..'           ],
[  "Unix->abs2rel('/.','/t1/t2/t3')",                 '../../..'           ],
[  "Unix->abs2rel('/./','/t1/t2/t3')",                '../../..'           ],
#[ "Unix->abs2rel('../t4','/t1/t2/t3')",              '../t4'              ],
[  "Unix->abs2rel('/t1/t2/t3', '/')",                 't1/t2/t3'           ],
[  "Unix->abs2rel('/t1/t2/t3', '/t1')",               't2/t3'              ],
[  "Unix->abs2rel('t1/t2/t3', 't1')",                 't2/t3'              ],
[  "Unix->abs2rel('t1/t2/t3', 't4')",                 '../t1/t2/t3'        ],

[ "Unix->rel2abs('t4','/t1/t2/t3')",             '/t1/t2/t3/t4'    ],
[ "Unix->rel2abs('t4/t5','/t1/t2/t3')",          '/t1/t2/t3/t4/t5' ],
[ "Unix->rel2abs('.','/t1/t2/t3')",              '/t1/t2/t3'       ],
[ "Unix->rel2abs('..','/t1/t2/t3')",             '/t1/t2/t3/..'    ],
[ "Unix->rel2abs('../t4','/t1/t2/t3')",          '/t1/t2/t3/../t4' ],
[ "Unix->rel2abs('/t1','/t1/t2/t3')",            '/t1'             ],

[ "Win32->case_tolerant()",         '1'  ],
[ "Win32->rootdir()",               '\\'  ],

[ "Win32->splitpath('file')",                            ',,file'                            ],
[ "Win32->splitpath('\\d1/d2\\d3/')",                    ',\\d1/d2\\d3/,'                    ],
[ "Win32->splitpath('d1/d2\\d3/')",                      ',d1/d2\\d3/,'                      ],
[ "Win32->splitpath('\\d1/d2\\d3/.')",                   ',\\d1/d2\\d3/.,'                   ],
[ "Win32->splitpath('\\d1/d2\\d3/..')",                  ',\\d1/d2\\d3/..,'                  ],
[ "Win32->splitpath('\\d1/d2\\d3/.file')",               ',\\d1/d2\\d3/,.file'               ],
[ "Win32->splitpath('\\d1/d2\\d3/file')",                ',\\d1/d2\\d3/,file'                ],
[ "Win32->splitpath('d1/d2\\d3/file')",                  ',d1/d2\\d3/,file'                  ],
[ "Win32->splitpath('C:\\d1/d2\\d3/')",                  'C:,\\d1/d2\\d3/,'                  ],
[ "Win32->splitpath('C:d1/d2\\d3/')",                    'C:,d1/d2\\d3/,'                    ],
[ "Win32->splitpath('C:\\d1/d2\\d3/file')",              'C:,\\d1/d2\\d3/,file'              ],
[ "Win32->splitpath('C:d1/d2\\d3/file')",                'C:,d1/d2\\d3/,file'                ],
[ "Win32->splitpath('C:\\../d2\\d3/file')",              'C:,\\../d2\\d3/,file'              ],
[ "Win32->splitpath('C:../d2\\d3/file')",                'C:,../d2\\d3/,file'                ],
[ "Win32->splitpath('\\../..\\d1/')",                    ',\\../..\\d1/,'                    ],
[ "Win32->splitpath('\\./.\\d1/')",                      ',\\./.\\d1/,'                      ],
[ "Win32->splitpath('\\\\node\\share\\d1/d2\\d3/')",     '\\\\node\\share,\\d1/d2\\d3/,'     ],
[ "Win32->splitpath('\\\\node\\share\\d1/d2\\d3/file')", '\\\\node\\share,\\d1/d2\\d3/,file' ],
[ "Win32->splitpath('\\\\node\\share\\d1/d2\\file')",    '\\\\node\\share,\\d1/d2\\,file'    ],
[ "Win32->splitpath('file',1)",                          ',file,'                            ],
[ "Win32->splitpath('\\d1/d2\\d3/',1)",                  ',\\d1/d2\\d3/,'                    ],
[ "Win32->splitpath('d1/d2\\d3/',1)",                    ',d1/d2\\d3/,'                      ],
[ "Win32->splitpath('\\\\node\\share\\d1/d2\\d3/',1)",   '\\\\node\\share,\\d1/d2\\d3/,'     ],

[ "Win32->catpath('','','file')",                            'file'                            ],
[ "Win32->catpath('','\\d1/d2\\d3/','')",                    '\\d1/d2\\d3/'                    ],
[ "Win32->catpath('','d1/d2\\d3/','')",                      'd1/d2\\d3/'                      ],
[ "Win32->catpath('','\\d1/d2\\d3/.','')",                   '\\d1/d2\\d3/.'                   ],
[ "Win32->catpath('','\\d1/d2\\d3/..','')",                  '\\d1/d2\\d3/..'                  ],
[ "Win32->catpath('','\\d1/d2\\d3/','.file')",               '\\d1/d2\\d3/.file'               ],
[ "Win32->catpath('','\\d1/d2\\d3/','file')",                '\\d1/d2\\d3/file'                ],
[ "Win32->catpath('','d1/d2\\d3/','file')",                  'd1/d2\\d3/file'                  ],
[ "Win32->catpath('C:','\\d1/d2\\d3/','')",                  'C:\\d1/d2\\d3/'                  ],
[ "Win32->catpath('C:','d1/d2\\d3/','')",                    'C:d1/d2\\d3/'                    ],
[ "Win32->catpath('C:','\\d1/d2\\d3/','file')",              'C:\\d1/d2\\d3/file'              ],
[ "Win32->catpath('C:','d1/d2\\d3/','file')",                'C:d1/d2\\d3/file'                ],
[ "Win32->catpath('C:','\\../d2\\d3/','file')",              'C:\\../d2\\d3/file'              ],
[ "Win32->catpath('C:','../d2\\d3/','file')",                'C:../d2\\d3/file'                ],
[ "Win32->catpath('','\\../..\\d1/','')",                    '\\../..\\d1/'                    ],
[ "Win32->catpath('','\\./.\\d1/','')",                      '\\./.\\d1/'                      ],
[ "Win32->catpath('\\\\node\\share','\\d1/d2\\d3/','')",     '\\\\node\\share\\d1/d2\\d3/'     ],
[ "Win32->catpath('\\\\node\\share','\\d1/d2\\d3/','file')", '\\\\node\\share\\d1/d2\\d3/file' ],
[ "Win32->catpath('\\\\node\\share','\\d1/d2\\','file')",    '\\\\node\\share\\d1/d2\\file'    ],

[ "Win32->splitdir('')",             ''           ],
[ "Win32->splitdir('\\d1/d2\\d3/')", ',d1,d2,d3,' ],
[ "Win32->splitdir('d1/d2\\d3/')",   'd1,d2,d3,'  ],
[ "Win32->splitdir('\\d1/d2\\d3')",  ',d1,d2,d3'  ],
[ "Win32->splitdir('d1/d2\\d3')",    'd1,d2,d3'   ],

[ "Win32->catdir()",                        ''                   ],
[ "Win32->catdir('')",                      '\\'                 ],
[ "Win32->catdir('/')",                     '\\'                 ],
[ "Win32->catdir('/', '../')",              '\\'                 ],
[ "Win32->catdir('/', '..\\')",             '\\'                 ],
[ "Win32->catdir('\\', '../')",             '\\'                 ],
[ "Win32->catdir('\\', '..\\')",            '\\'                 ],
[ "Win32->catdir('//d1','d2')",             '\\\\d1\\d2'         ],
[ "Win32->catdir('\\d1\\','d2')",           '\\d1\\d2'         ],
[ "Win32->catdir('\\d1','d2')",             '\\d1\\d2'         ],
[ "Win32->catdir('\\d1','\\d2')",           '\\d1\\d2'         ],
[ "Win32->catdir('\\d1','\\d2\\')",         '\\d1\\d2'         ],
[ "Win32->catdir('','/d1','d2')",           '\\d1\\d2'         ],
[ "Win32->catdir('','','/d1','d2')",        '\\d1\\d2'         ],
[ "Win32->catdir('','//d1','d2')",          '\\d1\\d2'         ],
[ "Win32->catdir('','','//d1','d2')",       '\\d1\\d2'         ],
[ "Win32->catdir('','d1','','d2','')",      '\\d1\\d2'           ],
[ "Win32->catdir('','d1','d2','d3','')",    '\\d1\\d2\\d3'       ],
[ "Win32->catdir('d1','d2','d3','')",       'd1\\d2\\d3'         ],
[ "Win32->catdir('','d1','d2','d3')",       '\\d1\\d2\\d3'       ],
[ "Win32->catdir('d1','d2','d3')",          'd1\\d2\\d3'         ],
[ "Win32->catdir('A:/d1','d2','d3')",       'A:\\d1\\d2\\d3'     ],
[ "Win32->catdir('A:/d1','d2','d3','')",    'A:\\d1\\d2\\d3'     ],
#[ "Win32->catdir('A:/d1','B:/d2','d3','')", 'A:\\d1\\d2\\d3'     ],
[ "Win32->catdir('A:/d1','B:/d2','d3','')", 'A:\\d1\\B:\\d2\\d3' ],
[ "Win32->catdir('A:/')",                   'A:\\'               ],
[ "Win32->catdir('\\', 'foo')",             '\\foo'              ],
[ "Win32->catdir('','','..')",              '\\'                 ],
[ "Win32->catdir('A:', 'foo')",             'A:\\foo'            ],

[ "Win32->catfile('a','b','c')",        'a\\b\\c' ],
[ "Win32->catfile('a','b','.\\c')",      'a\\b\\c'  ],
[ "Win32->catfile('.\\a','b','c')",      'a\\b\\c'  ],
[ "Win32->catfile('c')",                'c' ],
[ "Win32->catfile('.\\c')",              'c' ],
[ "Win32->catfile('a/..','../b')",       '..\\b' ],
[ "Win32->catfile('A:', 'foo')",         'A:\\foo'            ],


[ "Win32->canonpath('')",               ''                    ],
[ "Win32->canonpath('a:')",             'A:'                  ],
[ "Win32->canonpath('A:f')",            'A:f'                 ],
[ "Win32->canonpath('A:/')",            'A:\\'                ],
# rt.perl.org 27052
[ "Win32->canonpath('a\\..\\..\\b\\c')", '..\\b\\c'           ],
[ "Win32->canonpath('//a\\b//c')",      '\\\\a\\b\\c'         ],
[ "Win32->canonpath('/a/..../c')",      '\\a\\....\\c'        ],
[ "Win32->canonpath('//a/b\\c')",       '\\\\a\\b\\c'         ],
[ "Win32->canonpath('////')",           '\\'                  ],
[ "Win32->canonpath('//')",             '\\'                  ],
[ "Win32->canonpath('/.')",             '\\'                  ],
[ "Win32->canonpath('//a/b/../../c')",  '\\\\a\\b\\c'         ],
[ "Win32->canonpath('//a/b/c/../d')",   '\\\\a\\b\\d'         ],
[ "Win32->canonpath('//a/b/c/../../d')",'\\\\a\\b\\d'         ],
[ "Win32->canonpath('//a/b/c/.../d')",  '\\\\a\\b\\d'         ],
[ "Win32->canonpath('/a/b/c/../../d')", '\\a\\d'              ],
[ "Win32->canonpath('/a/b/c/.../d')",   '\\a\\d'              ],
[ "Win32->canonpath('\\../temp\\')",    '\\temp'              ],
[ "Win32->canonpath('\\../')",          '\\'                  ],
[ "Win32->canonpath('\\..\\')",         '\\'                  ],
[ "Win32->canonpath('/../')",           '\\'                  ],
[ "Win32->canonpath('/..\\')",          '\\'                  ],
[ "Win32->canonpath('d1/../foo')",      'foo'                 ],

[ "Win32->can('_cwd')",                 '/CODE/'              ],

# FakeWin32 subclass (see below) just sets CWD to C:\one\two and getdcwd('D') to D:\alpha\beta

[ "FakeWin32->abs2rel('/t1/t2/t3','/t1/t2/t3')",     '.'                      ],
[ "FakeWin32->abs2rel('/t1/t2/t4','/t1/t2/t3')",     '..\\t4'                 ],
[ "FakeWin32->abs2rel('/t1/t2','/t1/t2/t3')",        '..'                     ],
[ "FakeWin32->abs2rel('/t1/t2/t3/t4','/t1/t2/t3')",  't4'                     ],
[ "FakeWin32->abs2rel('/t4/t5/t6','/t1/t2/t3')",     '..\\..\\..\\t4\\t5\\t6' ],
[ "FakeWin32->abs2rel('../t4','/t1/t2/t3')",         '..\\..\\..\\one\\t4'    ],  # Uses _cwd()
[ "FakeWin32->abs2rel('/','/t1/t2/t3')",             '..\\..\\..'             ],
[ "FakeWin32->abs2rel('///','/t1/t2/t3')",           '..\\..\\..'             ],
[ "FakeWin32->abs2rel('/.','/t1/t2/t3')",            '..\\..\\..'             ],
[ "FakeWin32->abs2rel('/./','/t1/t2/t3')",           '..\\..\\..'             ],
[ "FakeWin32->abs2rel('\\\\a/t1/t2/t4','/t2/t3')",   '\\\\a\\t1\\t2\\t4'      ],
[ "FakeWin32->abs2rel('//a/t1/t2/t4','/t2/t3')",     '\\\\a\\t1\\t2\\t4'      ],
[ "FakeWin32->abs2rel('A:/t1/t2/t3','A:/t1/t2/t3')",     '.'                  ],
[ "FakeWin32->abs2rel('A:/t1/t2/t3/t4','A:/t1/t2/t3')",  't4'                 ],
[ "FakeWin32->abs2rel('A:/t1/t2/t3','A:/t1/t2/t3/t4')",  '..'                 ],
[ "FakeWin32->abs2rel('A:/t1/t2/t3','B:/t1/t2/t3')",     'A:\\t1\\t2\\t3'     ],
[ "FakeWin32->abs2rel('A:/t1/t2/t3/t4','B:/t1/t2/t3')",  'A:\\t1\\t2\\t3\\t4' ],
[ "FakeWin32->abs2rel('E:/foo/bar/baz')",            'E:\\foo\\bar\\baz'      ],
[ "FakeWin32->abs2rel('C:/one/two/three')",          'three'                  ],
[ "FakeWin32->abs2rel('C:\\Windows\\System32', 'C:\\')",  'Windows\System32'  ],
[ "FakeWin32->abs2rel('\\\\computer2\\share3\\foo.txt', '\\\\computer2\\share3')",  'foo.txt' ],
[ "FakeWin32->abs2rel('C:\\one\\two\\t\\asd1\\', 't\\asd\\')", '..\\asd1'     ],
[ "FakeWin32->abs2rel('\\one\\two', 'A:\\foo')",     'C:\\one\\two'           ],

[ "FakeWin32->rel2abs('temp','C:/')",                       'C:\\temp'                        ],
[ "FakeWin32->rel2abs('temp','C:/a')",                      'C:\\a\\temp'                     ],
[ "FakeWin32->rel2abs('temp','C:/a/')",                     'C:\\a\\temp'                     ],
[ "FakeWin32->rel2abs('../','C:/')",                        'C:\\'                            ],
[ "FakeWin32->rel2abs('../','C:/a')",                       'C:\\'                            ],
[ "FakeWin32->rel2abs('\\foo','C:/a')",                     'C:\\foo'                         ],
[ "FakeWin32->rel2abs('temp','//prague_main/work/')",       '\\\\prague_main\\work\\temp'     ],
[ "FakeWin32->rel2abs('../temp','//prague_main/work/')",    '\\\\prague_main\\work\\temp'     ],
[ "FakeWin32->rel2abs('temp','//prague_main/work')",        '\\\\prague_main\\work\\temp'     ],
[ "FakeWin32->rel2abs('../','//prague_main/work')",         '\\\\prague_main\\work'           ],
[ "FakeWin32->rel2abs('D:foo.txt')",                        'D:\\alpha\\beta\\foo.txt'        ],

[ "VMS->case_tolerant()",         '1'  ],

[ "VMS->catfile('a','b','c')", $vms_unix_rpt ? 'a/b/c' : '[.a.b]c'  ],
[ "VMS->catfile('a','b','[]c')",       '[.a.b]c'  ],
[ "VMS->catfile('[.a]','b','c')",       '[.a.b]c'  ],
[ "VMS->catfile('c')",                 'c' ],
[ "VMS->catfile('[]c')",               'c' ],

[ "VMS->catfile('0','b','c')", $vms_unix_rpt ? '0/b/c' : '[.0.b]c' ],
[ "VMS->catfile('a','0','c')", $vms_unix_rpt ? 'a/0/c' : '[.a.0]c' ],
[ "VMS->catfile('a','b','0')", $vms_unix_rpt ? 'a/b/0' : '[.a.b]0' ],
[ "VMS->catfile('0','0','c')", $vms_unix_rpt ? '0/0/c' : '[.0.0]c' ],
[ "VMS->catfile('a','0','0')", $vms_unix_rpt ? 'a/0/0' : '[.a.0]0' ],
[ "VMS->catfile('0','b','0')", $vms_unix_rpt ? '0/b/0' : '[.0.b]0' ],
[ "VMS->catfile('0','0','0')", $vms_unix_rpt ? '0/0/0' : '[.0.0]0' ],


[ "VMS->splitpath('file')",                                       ',,file'                                   ],
[ "VMS->splitpath('[d1.d2.d3]')",                                 ',[d1.d2.d3],'                               ],
[ "VMS->splitpath('[.d1.d2.d3]')",                                ',[.d1.d2.d3],'                              ],
[ "VMS->splitpath('[d1.d2.d3]file')",                             ',[d1.d2.d3],file'                           ],
[ "VMS->splitpath('d1/d2/d3/file')",
       $vms_efs ? ',d1/d2/d3/,file' : ',[.d1.d2.d3],file' ],
[ "VMS->splitpath('/d1/d2/d3/file')",
       $vms_efs ? ',/d1/d2/d3/,file' : 'd1:,[d2.d3],file' ],
[ "VMS->splitpath('[.d1.d2.d3]file')",                            ',[.d1.d2.d3],file'                          ],
[ "VMS->splitpath('node::volume:[d1.d2.d3]')",                    'node::volume:,[d1.d2.d3],'                  ],
[ "VMS->splitpath('node::volume:[d1.d2.d3]file')",                'node::volume:,[d1.d2.d3],file'              ],
[ "VMS->splitpath('node\"access_spec\"::volume:[d1.d2.d3]')",     'node"access_spec"::volume:,[d1.d2.d3],'     ],
[ "VMS->splitpath('node\"access_spec\"::volume:[d1.d2.d3]file')", 'node"access_spec"::volume:,[d1.d2.d3],file' ],

[ "VMS->splitpath('[]')",                                         ',[],'                                       ],
[ "VMS->splitpath('[-]')",                                        ',[-],'                                      ],
[ "VMS->splitpath('[]file')",                                     ',[],file'                                   ],
[ "VMS->splitpath('[-]file')",                                    ',[-],file'                                  ],
[ "VMS->splitpath('')",                                           ',,'                                         ],
[ "VMS->splitpath('0')",                                          ',,0'                                        ],
[ "VMS->splitpath('[0]')",                                        ',[0],'                                      ],
[ "VMS->splitpath('[.0]')",                                       ',[.0],'                                     ],
[ "VMS->splitpath('[0.0.0]')",                                    ',[0.0.0],'                                  ],
[ "VMS->splitpath('[.0.0.0]')",                                   ',[.0.0.0],'                                 ],
[ "VMS->splitpath('[0]0')",                                       ',[0],0'                                     ],
[ "VMS->splitpath('[0.0.0]0')",                                   ',[0.0.0],0'                                 ],
[ "VMS->splitpath('[.0.0.0]0')",                                  ',[.0.0.0],0'                                ],
[ "VMS->splitpath('0/0')",    $vms_efs ? ',0/,0' : ',[.0],0'  ],
[ "VMS->splitpath('0/0/0')",  $vms_efs ? ',0/0/,0' : ',[.0.0],0'  ],
[ "VMS->splitpath('/0/0')",   $vms_efs ? ',/0/,0' : '0:,[000000],0'  ],
[ "VMS->splitpath('/0/0/0')", $vms_efs ? ',/0/0/,0' : '0:,[0],0'  ],
[ "VMS->splitpath('d1',1)",                                       ',d1,'                                       ],
# $no_file tests
[ "VMS->splitpath('[d1.d2.d3]',1)",                               ',[d1.d2.d3],'                               ],
[ "VMS->splitpath('[.d1.d2.d3]',1)",                              ',[.d1.d2.d3],'                              ],
[ "VMS->splitpath('d1/d2/d3',1)",  $vms_efs ? ',d1/d2/d3,' : ',[.d1.d2.d3],' ],
[ "VMS->splitpath('/d1/d2/d3',1)", $vms_efs ? ',/d1/d2/d3,' : 'd1:,[d2.d3],' ],
[ "VMS->splitpath('node::volume:[d1.d2.d3]',1)",                  'node::volume:,[d1.d2.d3],'                  ],
[ "VMS->splitpath('node\"access_spec\"::volume:[d1.d2.d3]',1)",   'node"access_spec"::volume:,[d1.d2.d3],'     ],
[ "VMS->splitpath('[]',1)",                                       ',[],'                                       ],
[ "VMS->splitpath('[-]',1)",                                      ',[-],'                                      ],
[ "VMS->splitpath('',1)",                                         ',,'                                         ],
[ "VMS->splitpath('0',1)",                                        ',0,'                                        ],
[ "VMS->splitpath('[0]',1)",                                      ',[0],'                                      ],
[ "VMS->splitpath('[.0]',1)",                                     ',[.0],'                                     ],
[ "VMS->splitpath('[0.0.0]',1)",                                  ',[0.0.0],'                                  ],
[ "VMS->splitpath('[.0.0.0]',1)",                                 ',[.0.0.0],'                                 ],
[ "VMS->splitpath('0/0',1)",    $vms_efs ? ',0/0,' : ',[.0.0],' ],
[ "VMS->splitpath('0/0/0',1)",  $vms_efs ? ',0/0/0,' : ',[.0.0.0],' ],
[ "VMS->splitpath('/0/0',1)",   $vms_efs ? ',/0/0,' : '0:,[000000.0],' ],
[ "VMS->splitpath('/0/0/0',1)", $vms_efs ? ',/0/0/0,' : '0:,[0.0],' ],

[ "VMS->catpath('','','file')",                                       'file'                                     ],
[ "VMS->catpath('','[d1.d2.d3]','')",                                 '[d1.d2.d3]'                               ],
[ "VMS->catpath('','[.d1.d2.d3]','')",                                '[.d1.d2.d3]'                              ],
[ "VMS->catpath('','[d1.d2.d3]','file')",                             '[d1.d2.d3]file'                           ],
[ "VMS->catpath('','[.d1.d2.d3]','file')",                            '[.d1.d2.d3]file'                          ],
[ "VMS->catpath('','d1/d2/d3','file')",
                             $vms_efs ? 'd1/d2/d3/file' : '[.d1.d2.d3]file' ],
[ "VMS->catpath('v','d1/d2/d3','file')",                              'v:[.d1.d2.d3]file' ],
[ "VMS->catpath('v','','file')",                                      'v:file' ],
[ "VMS->catpath('v','w:[d1.d2.d3]','file')",                          'v:[d1.d2.d3]file'                         ],
[ "VMS->catpath('node::volume:','[d1.d2.d3]','')",                    'node::volume:[d1.d2.d3]'                  ],
[ "VMS->catpath('node::volume:','[d1.d2.d3]','file')",                'node::volume:[d1.d2.d3]file'              ],
[ "VMS->catpath('node\"access_spec\"::volume:','[d1.d2.d3]','')",     'node"access_spec"::volume:[d1.d2.d3]'     ],
[ "VMS->catpath('node\"access_spec\"::volume:','[d1.d2.d3]','file')", 'node"access_spec"::volume:[d1.d2.d3]file' ],

[ "VMS->canonpath('')",                                    ''                        ],
[ "VMS->canonpath('volume:[d1]file')",                     'volume:[d1]file'         ],
[ "VMS->canonpath('volume:[d1.-.d2.][d3.d4.-]')",              'volume:[d2.d3]'          ],
[ "VMS->canonpath('volume:[000000.d1]d2.dir;1')",                 'volume:[d1]d2.dir;1'   ],
[ "VMS->canonpath('volume:[d1.d2.d3]file.txt')", 	'volume:[d1.d2.d3]file.txt' ],
[ "VMS->canonpath('[d1.d2.d3]file.txt')", 		'[d1.d2.d3]file.txt' ],
[ "VMS->canonpath('volume:[-.d1.d2.d3]file.txt')", 	'volume:[-.d1.d2.d3]file.txt' ],
[ "VMS->canonpath('[-.d1.d2.d3]file.txt')", 		'[-.d1.d2.d3]file.txt' ],
[ "VMS->canonpath('volume:[--.d1.d2.d3]file.txt')", 	'volume:[--.d1.d2.d3]file.txt' ],
[ "VMS->canonpath('[--.d1.d2.d3]file.txt')", 		'[--.d1.d2.d3]file.txt' ],
[ "VMS->canonpath('volume:[d1.-.d2.d3]file.txt')", 	'volume:[d2.d3]file.txt' ],
[ "VMS->canonpath('[d1.-.d2.d3]file.txt')", 		'[d2.d3]file.txt' ],
[ "VMS->canonpath('volume:[d1.--.d2.d3]file.txt')", 	'volume:[-.d2.d3]file.txt' ],
[ "VMS->canonpath('[d1.--.d2.d3]file.txt')", 		'[-.d2.d3]file.txt' ],
[ "VMS->canonpath('volume:[d1.d2.-.d3]file.txt')", 	'volume:[d1.d3]file.txt' ],
[ "VMS->canonpath('[d1.d2.-.d3]file.txt')", 		'[d1.d3]file.txt' ],
[ "VMS->canonpath('volume:[d1.d2.--.d3]file.txt')", 	'volume:[d3]file.txt' ],
[ "VMS->canonpath('[d1.d2.--.d3]file.txt')", 		'[d3]file.txt' ],
[ "VMS->canonpath('volume:[d1.d2.d3.-]file.txt')", 	'volume:[d1.d2]file.txt' ],
[ "VMS->canonpath('[d1.d2.d3.-]file.txt')", 		'[d1.d2]file.txt' ],
[ "VMS->canonpath('volume:[d1.d2.d3.--]file.txt')", 	'volume:[d1]file.txt' ],
[ "VMS->canonpath('[d1.d2.d3.--]file.txt')", 		'[d1]file.txt' ],
[ "VMS->canonpath('volume:[d1.000000.][000000.][d3.--]file.txt')", 	'volume:[d1]file.txt' ],
[ "VMS->canonpath('[d1.000000.][000000.][d3.--]file.txt')", 		'[d1]file.txt' ],
[ "VMS->canonpath('volume:[d1.000000.][000000.][d2.000000]file.txt')",	'volume:[d1.000000.d2.000000]file.txt' ],
[ "VMS->canonpath('[d1.000000.][000000.][d2.000000]file.txt')", 	'[d1.000000.d2.000000]file.txt' ],
[ "VMS->canonpath('volume:[d1.000000.][000000.][d3.--.000000]file.txt')",'volume:[d1.000000]file.txt' ],
[ "VMS->canonpath('[d1.000000.][000000.][d3.--.000000]file.txt')", 	'[d1.000000]file.txt' ],
[ "VMS->canonpath('volume:[d1.000000.][000000.][-.-.000000]file.txt')",	'volume:[000000]file.txt' ],
[ "VMS->canonpath('[d1.000000.][000000.][--.-.000000]file.txt')", 	'[-.000000]file.txt' ],
[ "VMS->canonpath('[d1.d2.--]file')",                                   '[000000]file'       ],

[ "VMS->splitdir('')",            ''          ],
[ "VMS->splitdir('[]')",          ''          ],
[ "VMS->splitdir('d1.d2.d3')",    'd1,d2,d3'  ],
[ "VMS->splitdir('[d1.d2.d3]')",  'd1,d2,d3'  ],
[ "VMS->splitdir('.d1.d2.d3')",   'd1,d2,d3' ],
[ "VMS->splitdir('[.d1.d2.d3]')", 'd1,d2,d3' ],
[ "VMS->splitdir('.-.d2.d3')",    '-,d2,d3'  ],
[ "VMS->splitdir('[.-.d2.d3]')",  '-,d2,d3'  ],
[ "VMS->splitdir('[d1.d2]')",  		'd1,d2'  ],
[ "VMS->splitdir('[d1-.--d2]')",  	'd1-,--d2'  ],
[ "VMS->splitdir('[d1---.-.d2]')",  	'd1---,-,d2'  ],
[ "VMS->splitdir('[d1.---.d2]')",  	'd1,-,-,-,d2'  ],
[ "VMS->splitdir('[d1---d2]')",  	'd1---d2'  ],
[ "VMS->splitdir('[d1.][000000.d2]')",  'd1,d2'  ],
[ "VMS->splitdir('[.d1.d2^.d3]')", 'd1,d2^.d3' ],

[ "VMS->catdir('')",                            ''                 ],
[ "VMS->catdir('d1','d2','d3')",   $vms_unix_rpt ? 'd1/d2/d3' : '[.d1.d2.d3]' ],
[ "VMS->catdir('d1','d2/','d3')",  $vms_efs ? 'd1/d2/d3' : '[.d1.d2.d3]' ],
[ "VMS->catdir('','d1','d2','d3')", 
             $vms_unix_rpt ? '/d1/d2/d3' : 
                  $vms_efs ? '[d1.d2.d3]' : '[.d1.d2.d3]' ],
[ "VMS->catdir('','-','d2','d3')",              '[-.d2.d3]'         ],
[ "VMS->catdir('','-','','d3')",                '[-.d3]'            ],
[ "VMS->catdir('dir.dir','d2.dir','d3.dir')",
              $vms_unix_rpt ? 'dir.dir/d2.dir/d3.dir' : '[.dir.d2.d3]' ],
[ "VMS->catdir('[.name]')",                     '[.name]'            ],
[ "VMS->catdir('[.name]','[.name]')",           '[.name.name]'],

[  "VMS->abs2rel('node::volume:[t1.t2.t3]','node::volume:[t1.t2.t3]')", '[]'                 ],
[  "VMS->abs2rel('node::volume:[t1.t2.t3]','[t1.t2.t3]')", 'node::volume:[t1.t2.t3]'                 ],
[  "VMS->abs2rel('node::volume:[t1.t2.t4]','node::volume:[t1.t2.t3]')", '[-.t4]'           ],
[  "VMS->abs2rel('node::volume:[t1.t2.t4]','[t1.t2.t3]')", 'node::volume:[t1.t2.t4]'           ],
[  "VMS->abs2rel('[t1.t2.t3]','[t1.t2.t3]')",              '[]'               ],
[  "VMS->abs2rel('[t1.t2.t3]file','[t1.t2.t3]')",          'file'             ],
[  "VMS->abs2rel('[t1.t2.t3]file','[t1.t2]')",             '[.t3]file'        ],
[  "VMS->abs2rel('v:[t1.t2.t3]file','v:[t1.t2]')",         '[.t3]file'        ],
[  "VMS->abs2rel('[t1.t2.t4]','[t1.t2.t3]')",              '[-.t4]'           ],
[  "VMS->abs2rel('[t1.t2]file','[t1.t2.t3]')",             '[-]file'          ],
[  "VMS->abs2rel('[t1.t2.t3.t4]','[t1.t2.t3]')",           '[.t4]'            ],
[  "VMS->abs2rel('[t4.t5.t6]','[t1.t2.t3]')",              '[---.t4.t5.t6]'   ],
[ "VMS->abs2rel('[000000]','[t1.t2.t3]')",                 '[---]'            ],
[ "VMS->abs2rel('a:[t1.t2.t4]','a:[t1.t2.t3]')",           '[-.t4]'           ],
[ "VMS->abs2rel('a:[t1.t2.t4]','[t1.t2.t3]')",             'a:[t1.t2.t4]'           ],
[ "VMS->abs2rel('[a.-.b.c.-]','[t1.t2.t3]')",              '[---.b]'          ],

[ "VMS->rel2abs('[.t4]','[t1.t2.t3]')",          '[t1.t2.t3.t4]'    ],
[ "VMS->rel2abs('[.t4.t5]','[t1.t2.t3]')",       '[t1.t2.t3.t4.t5]' ],
[ "VMS->rel2abs('[]','[t1.t2.t3]')",             '[t1.t2.t3]'       ],
[ "VMS->rel2abs('[-]','[t1.t2.t3]')",            '[t1.t2]'          ],
[ "VMS->rel2abs('[-.t4]','[t1.t2.t3]')",         '[t1.t2.t4]'       ],
[ "VMS->rel2abs('[t1]','[t1.t2.t3]')",           '[t1]'             ],

[ "OS2->case_tolerant()",         '1'  ],

[ "OS2->catdir('A:/d1','B:/d2','d3','')", 'A:/d1/B:/d2/d3' ],

[ "OS2->catfile('a','b','c')",            'a/b/c'          ],
[ "OS2->catfile('a','b','./c')",          'a/b/c'  ],
[ "OS2->catfile('./a','b','c')",          'a/b/c'  ],
[ "OS2->catfile('c')",                    'c' ],
[ "OS2->catfile('./c')",                  'c' ],

[ "OS2->catdir('/', '../')",              '/'                 ],
[ "OS2->catdir('/', '..\\')",             '/'                 ],
[ "OS2->catdir('\\', '../')",             '/'                 ],
[ "OS2->catdir('\\', '..\\')",            '/'                 ],

[ "Mac->case_tolerant()",         '1'  ],

[ "Mac->catpath('','','')",              ''                ],
[ "Mac->catpath('',':','')",             ':'               ],
[ "Mac->catpath('','::','')",            '::'              ],

[ "Mac->catpath('hd','','')",            'hd:'             ],
[ "Mac->catpath('hd:','','')",           'hd:'             ],
[ "Mac->catpath('hd:',':','')",          'hd:'             ],
[ "Mac->catpath('hd:','::','')",         'hd::'            ],

[ "Mac->catpath('hd','','file')",       'hd:file'          ],
[ "Mac->catpath('hd',':','file')",      'hd:file'          ],
[ "Mac->catpath('hd','::','file')",     'hd::file'         ],
[ "Mac->catpath('hd',':::','file')",    'hd:::file'        ],

[ "Mac->catpath('hd:','',':file')",      'hd:file'         ],
[ "Mac->catpath('hd:',':',':file')",     'hd:file'         ],
[ "Mac->catpath('hd:','::',':file')",    'hd::file'        ],
[ "Mac->catpath('hd:',':::',':file')",   'hd:::file'       ],

[ "Mac->catpath('hd:','d1','file')",     'hd:d1:file'      ],
[ "Mac->catpath('hd:',':d1:',':file')",  'hd:d1:file'      ],
[ "Mac->catpath('hd:','hd:d1','')",      'hd:d1:'          ],

[ "Mac->catpath('','d1','')",            ':d1:'            ],
[ "Mac->catpath('',':d1','')",           ':d1:'            ],
[ "Mac->catpath('',':d1:','')",          ':d1:'            ],

[ "Mac->catpath('','d1','file')",        ':d1:file'        ],
[ "Mac->catpath('',':d1:',':file')",     ':d1:file'        ],

[ "Mac->catpath('','','file')",          'file'            ],
[ "Mac->catpath('','',':file')",         'file'            ], # !
[ "Mac->catpath('',':',':file')",        ':file'           ], # !


[ "Mac->splitpath(':')",              ',:,'               ],
[ "Mac->splitpath('::')",             ',::,'              ],
[ "Mac->splitpath(':::')",            ',:::,'             ],

[ "Mac->splitpath('file')",           ',,file'            ],
[ "Mac->splitpath(':file')",          ',:,file'           ],

[ "Mac->splitpath('d1',1)",           ',:d1:,'            ], # dir, not volume
[ "Mac->splitpath(':d1',1)",          ',:d1:,'            ],
[ "Mac->splitpath(':d1:',1)",         ',:d1:,'            ],
[ "Mac->splitpath(':d1:')",           ',:d1:,'            ],
[ "Mac->splitpath(':d1:d2:d3:')",     ',:d1:d2:d3:,'      ],
[ "Mac->splitpath(':d1:d2:d3:',1)",   ',:d1:d2:d3:,'      ],
[ "Mac->splitpath(':d1:file')",       ',:d1:,file'        ],
[ "Mac->splitpath('::d1:file')",      ',::d1:,file'       ],

[ "Mac->splitpath('hd:', 1)",         'hd:,,'             ],
[ "Mac->splitpath('hd:')",            'hd:,,'             ],
[ "Mac->splitpath('hd:d1:d2:')",      'hd:,:d1:d2:,'      ],
[ "Mac->splitpath('hd:d1:d2',1)",     'hd:,:d1:d2:,'      ],
[ "Mac->splitpath('hd:d1:d2:file')",  'hd:,:d1:d2:,file'  ],
[ "Mac->splitpath('hd:d1:d2::file')", 'hd:,:d1:d2::,file' ],
[ "Mac->splitpath('hd::d1:d2:file')", 'hd:,::d1:d2:,file' ], # invalid path
[ "Mac->splitpath('hd:file')",        'hd:,,file'         ],

[ "Mac->splitdir()",                   ''            ],
[ "Mac->splitdir('')",                 ''            ],
[ "Mac->splitdir(':')",                ':'           ],
[ "Mac->splitdir('::')",               '::'          ],
[ "Mac->splitdir(':::')",              '::,::'       ],
[ "Mac->splitdir(':::d1:d2')",         '::,::,d1,d2' ],

[ "Mac->splitdir(':d1:d2:d3::')",      'd1,d2,d3,::'],
[ "Mac->splitdir(':d1:d2:d3:')",       'd1,d2,d3'   ],
[ "Mac->splitdir(':d1:d2:d3')",        'd1,d2,d3'   ],

# absolute paths in splitdir() work, but you'd better use splitpath()
[ "Mac->splitdir('hd:')",              'hd:'              ],
[ "Mac->splitdir('hd::')",             'hd:,::'           ], # invalid path, but it works
[ "Mac->splitdir('hd::d1:')",          'hd:,::,d1'        ], # invalid path, but it works
[ "Mac->splitdir('hd:d1:d2:::')",      'hd:,d1,d2,::,::'  ],
[ "Mac->splitdir('hd:d1:d2::')",       'hd:,d1,d2,::'     ],
[ "Mac->splitdir('hd:d1:d2:')",        'hd:,d1,d2'        ],
[ "Mac->splitdir('hd:d1:d2')",         'hd:,d1,d2'        ],
[ "Mac->splitdir('hd:d1::d2::')",      'hd:,d1,::,d2,::'  ],

[ "Mac->catdir()",                 ''             ],
[ "Mac->catdir('')",               $root, 'MacOS' ], # skipped on other OS
[ "Mac->catdir(':')",              ':'            ],

[ "Mac->catdir('', '')",           $root, 'MacOS' ], # skipped on other OS
[ "Mac->catdir('', ':')",          $root, 'MacOS' ], # skipped on other OS
[ "Mac->catdir(':', ':')",         ':'            ],
[ "Mac->catdir(':', '')",          ':'            ],

[ "Mac->catdir('', '::')",         $root, 'MacOS' ], # skipped on other OS
[ "Mac->catdir(':', '::')",        '::'           ],

[ "Mac->catdir('::', '')",         '::'           ],
[ "Mac->catdir('::', ':')",        '::'           ],

[ "Mac->catdir('::', '::')",       ':::'          ],

[ "Mac->catdir(':d1')",                    ':d1:'        ],
[ "Mac->catdir(':d1:')",                   ':d1:'        ],
[ "Mac->catdir(':d1','d2')",               ':d1:d2:'     ],
[ "Mac->catdir(':d1',':d2')",              ':d1:d2:'     ],
[ "Mac->catdir(':d1',':d2:')",             ':d1:d2:'     ],
[ "Mac->catdir(':d1',':d2::')",            ':d1:d2::'     ],
[ "Mac->catdir(':',':d1',':d2')",          ':d1:d2:'     ],
[ "Mac->catdir('::',':d1',':d2')",         '::d1:d2:'    ],
[ "Mac->catdir('::','::',':d1',':d2')",    ':::d1:d2:'   ],
[ "Mac->catdir(':',':',':d1',':d2')",      ':d1:d2:'     ],
[ "Mac->catdir('::',':',':d1',':d2')",     '::d1:d2:'    ],

[ "Mac->catdir('d1')",                    ':d1:'         ],
[ "Mac->catdir('d1','d2','d3')",          ':d1:d2:d3:'   ],
[ "Mac->catdir('d1','d2/','d3')",         ':d1:d2/:d3:'  ],
[ "Mac->catdir('d1','',':d2')",           ':d1:d2:'      ],
[ "Mac->catdir('d1',':',':d2')",          ':d1:d2:'      ],
[ "Mac->catdir('d1','::',':d2')",         ':d1::d2:'     ],
[ "Mac->catdir('d1',':::',':d2')",        ':d1:::d2:'    ],
[ "Mac->catdir('d1','::','::',':d2')",    ':d1:::d2:'    ],
[ "Mac->catdir('d1','d2')",               ':d1:d2:'      ],
[ "Mac->catdir('d1','d2', '')",           ':d1:d2:'      ],
[ "Mac->catdir('d1','d2', ':')",          ':d1:d2:'      ],
[ "Mac->catdir('d1','d2', '::')",         ':d1:d2::'     ],
[ "Mac->catdir('d1','d2','','')",         ':d1:d2:'      ],
[ "Mac->catdir('d1','d2',':','::')",      ':d1:d2::'     ],
[ "Mac->catdir('d1','d2','::','::')",     ':d1:d2:::'    ],
[ "Mac->catdir('d1',':d2')",              ':d1:d2:'      ],
[ "Mac->catdir('d1',':d2:')",             ':d1:d2:'      ],

[ "Mac->catdir('','d1','d2','d3')",        $root . 'd1:d2:d3:', 'MacOS' ], # skipped on other OS
[ "Mac->catdir('',':','d1','d2')",         $root . 'd1:d2:'   , 'MacOS' ], # skipped on other OS
[ "Mac->catdir('','::','d1','d2')",        $root . 'd1:d2:'   , 'MacOS' ], # skipped on other OS
[ "Mac->catdir('',':','','d1')",           $root . 'd1:'      , 'MacOS' ], # skipped on other OS
[ "Mac->catdir('', ':d1',':d2')",          $root . 'd1:d2:'   , 'MacOS' ], # skipped on other OS
[ "Mac->catdir('','',':d1',':d2')",        $root . 'd1:d2:'   , 'MacOS' ], # skipped on other OS

[ "Mac->catdir('hd:',':d1')",       'hd:d1:'      ],
[ "Mac->catdir('hd:d1:',':d2')",    'hd:d1:d2:'   ],
[ "Mac->catdir('hd:','d1')",        'hd:d1:'      ],
[ "Mac->catdir('hd:d1:',':d2')",    'hd:d1:d2:'   ],
[ "Mac->catdir('hd:d1:',':d2:')",   'hd:d1:d2:'   ],

[ "Mac->catfile()",                      ''                      ],
[ "Mac->catfile('')",                    ''                      ],
[ "Mac->catfile('', '')",                $root         , 'MacOS' ], # skipped on other OS
[ "Mac->catfile('', 'file')",            $root . 'file', 'MacOS' ], # skipped on other OS
[ "Mac->catfile(':')",                   ':'                     ],
[ "Mac->catfile(':', '')",               ':'                     ],

[ "Mac->catfile('d1','d2','file')",      ':d1:d2:file' ],
[ "Mac->catfile('d1','d2',':file')",     ':d1:d2:file' ],
[ "Mac->catfile('file')",                'file'        ],
[ "Mac->catfile(':', 'file')",           ':file'       ],

[ "Mac->canonpath('')",                   ''     ],
[ "Mac->canonpath(':')",                  ':'    ],
[ "Mac->canonpath('::')",                 '::'   ],
[ "Mac->canonpath('a::')",                'a::'  ],
[ "Mac->canonpath(':a::')",               ':a::' ],

[ "Mac->abs2rel('hd:d1:d2:','hd:d1:d2:')",            ':'            ],
[ "Mac->abs2rel('hd:d1:d2:','hd:d1:d2:file')",        ':'            ], # ignore base's file portion
[ "Mac->abs2rel('hd:d1:d2:file','hd:d1:d2:')",        ':file'        ],
[ "Mac->abs2rel('hd:d1:','hd:d1:d2:')",               '::'           ],
[ "Mac->abs2rel('hd:d3:','hd:d1:d2:')",               ':::d3:'       ],
[ "Mac->abs2rel('hd:d3:','hd:d1:d2::')",              '::d3:'        ],
[ "Mac->abs2rel('hd:d1:d4:d5:','hd:d1::d2:d3::')",    '::d1:d4:d5:'  ],
[ "Mac->abs2rel('hd:d1:d4:d5:','hd:d1::d2:d3:')",     ':::d1:d4:d5:' ], # first, resolve updirs in base
[ "Mac->abs2rel('hd:d1:d3:','hd:d1:d2:')",            '::d3:'        ],
[ "Mac->abs2rel('hd:d1::d3:','hd:d1:d2:')",           ':::d3:'       ],
[ "Mac->abs2rel('hd:d3:','hd:d1:d2:')",               ':::d3:'       ], # same as above
[ "Mac->abs2rel('hd:d1:d2:d3:','hd:d1:d2:')",         ':d3:'         ],
[ "Mac->abs2rel('hd:d1:d2:d3::','hd:d1:d2:')",        ':d3::'        ],
[ "Mac->abs2rel('hd1:d3:d4:d5:','hd2:d1:d2:')",       'hd1:d3:d4:d5:'], # volume mismatch
[ "Mac->abs2rel('hd:','hd:d1:d2:')",                  ':::'          ],

[ "Mac->rel2abs(':d3:','hd:d1:d2:')",          'hd:d1:d2:d3:'     ],
[ "Mac->rel2abs(':d3:d4:','hd:d1:d2:')",       'hd:d1:d2:d3:d4:'  ],
[ "Mac->rel2abs('','hd:d1:d2:')",              ''                 ],
[ "Mac->rel2abs('::','hd:d1:d2:')",            'hd:d1:d2::'       ],
[ "Mac->rel2abs('::','hd:d1:d2:file')",        'hd:d1:d2::'       ],# ignore base's file portion
[ "Mac->rel2abs(':file','hd:d1:d2:')",         'hd:d1:d2:file'    ],
[ "Mac->rel2abs('::file','hd:d1:d2:')",        'hd:d1:d2::file'   ],
[ "Mac->rel2abs('::d3:','hd:d1:d2:')",         'hd:d1:d2::d3:'    ],
[ "Mac->rel2abs('hd:','hd:d1:d2:')",           'hd:'              ], # path already absolute
[ "Mac->rel2abs('hd:d3:file','hd:d1:d2:')",    'hd:d3:file'       ],
[ "Mac->rel2abs('hd:d3:','hd:d1:file')",       'hd:d3:'           ],

[ "Epoc->case_tolerant()",         '1'  ],

[ "Epoc->canonpath('')",                                      ''          ],
[ "Epoc->canonpath('///../../..//./././a//b/.././c/././')",   '/a/b/../c' ],
[ "Epoc->canonpath('/./')",                                   '/'         ],
[ "Epoc->canonpath('/a/./')",                                 '/a'        ],

# XXX Todo, copied from Unix, but fail. Should they? 2003-07-07 Tels
#[ "Epoc->canonpath('/a/.')",                                  '/a'        ],
#[ "Epoc->canonpath('/.')",                                    '/'         ],

[ "Cygwin->case_tolerant()",         '1'  ],
[ "Cygwin->catfile('a','b','c')",         'a/b/c'  ],
[ "Cygwin->catfile('a','b','./c')",       'a/b/c'  ],
[ "Cygwin->catfile('./a','b','c')",       'a/b/c'  ],
[ "Cygwin->catfile('c')",                 'c' ],
[ "Cygwin->catfile('./c')",               'c' ],

[ "Cygwin->splitpath('file')",            ',,file'            ],
[ "Cygwin->splitpath('/d1/d2/d3/')",      ',/d1/d2/d3/,'      ],
[ "Cygwin->splitpath('d1/d2/d3/')",       ',d1/d2/d3/,'       ],
[ "Cygwin->splitpath('/d1/d2/d3/.')",     ',/d1/d2/d3/.,'     ],
[ "Cygwin->splitpath('/d1/d2/d3/..')",    ',/d1/d2/d3/..,'    ],
[ "Cygwin->splitpath('/d1/d2/d3/.file')", ',/d1/d2/d3/,.file' ],
[ "Cygwin->splitpath('d1/d2/d3/file')",   ',d1/d2/d3/,file'   ],
[ "Cygwin->splitpath('/../../d1/')",      ',/../../d1/,'      ],
[ "Cygwin->splitpath('/././d1/')",        ',/././d1/,'        ],

[ "Cygwin->catpath('','','file')",            'file'            ],
[ "Cygwin->catpath('','/d1/d2/d3/','')",      '/d1/d2/d3/'      ],
[ "Cygwin->catpath('','d1/d2/d3/','')",       'd1/d2/d3/'       ],
[ "Cygwin->catpath('','/d1/d2/d3/.','')",     '/d1/d2/d3/.'     ],
[ "Cygwin->catpath('','/d1/d2/d3/..','')",    '/d1/d2/d3/..'    ],
[ "Cygwin->catpath('','/d1/d2/d3/','.file')", '/d1/d2/d3/.file' ],
[ "Cygwin->catpath('','d1/d2/d3/','file')",   'd1/d2/d3/file'   ],
[ "Cygwin->catpath('','/../../d1/','')",      '/../../d1/'      ],
[ "Cygwin->catpath('','/././d1/','')",        '/././d1/'        ],
[ "Cygwin->catpath('d1','d2/d3/','')",        'd2/d3/'          ],
[ "Cygwin->catpath('d1','d2','d3/')",         'd2/d3/'          ],

[ "Cygwin->splitdir('')",           ''           ],
[ "Cygwin->splitdir('/d1/d2/d3/')", ',d1,d2,d3,' ],
[ "Cygwin->splitdir('d1/d2/d3/')",  'd1,d2,d3,'  ],
[ "Cygwin->splitdir('/d1/d2/d3')",  ',d1,d2,d3'  ],
[ "Cygwin->splitdir('d1/d2/d3')",   'd1,d2,d3'   ],

[ "Cygwin->catdir()",                     ''          ],
[ "Cygwin->catdir('/')",                  '/'         ],
[ "Cygwin->catdir('','d1','d2','d3','')", '/d1/d2/d3' ],
[ "Cygwin->catdir('d1','d2','d3','')",    'd1/d2/d3'  ],
[ "Cygwin->catdir('','d1','d2','d3')",    '/d1/d2/d3' ],
[ "Cygwin->catdir('d1','d2','d3')",       'd1/d2/d3'  ],
[ "Cygwin->catdir('/','d2/d3')",     '/d2/d3'  ],

[ "Cygwin->canonpath('///../../..//./././a//b/.././c/././')",   '/a/b/../c' ],
[ "Cygwin->canonpath('')",                       ''               ],
[ "Cygwin->canonpath('a/../../b/c')",            'a/../../b/c'    ],
[ "Cygwin->canonpath('/.')",                     '/'              ],
[ "Cygwin->canonpath('/./')",                    '/'              ],
[ "Cygwin->canonpath('/a/./')",                  '/a'             ],
[ "Cygwin->canonpath('/a/.')",                   '/a'             ],
[ "Cygwin->canonpath('/../../')",                '/'              ],
[ "Cygwin->canonpath('/../..')",                 '/'              ],

[  "Cygwin->abs2rel('/t1/t2/t3','/t1/t2/t3')",          '.'                  ],
[  "Cygwin->abs2rel('/t1/t2/t4','/t1/t2/t3')",          '../t4'              ],
[  "Cygwin->abs2rel('/t1/t2','/t1/t2/t3')",             '..'                 ],
[  "Cygwin->abs2rel('/t1/t2/t3/t4','/t1/t2/t3')",       't4'                 ],
[  "Cygwin->abs2rel('/t4/t5/t6','/t1/t2/t3')",          '../../../t4/t5/t6'  ],
#[ "Cygwin->abs2rel('../t4','/t1/t2/t3')",              '../t4'              ],
[  "Cygwin->abs2rel('/','/t1/t2/t3')",                  '../../..'           ],
[  "Cygwin->abs2rel('///','/t1/t2/t3')",                '../../..'           ],
[  "Cygwin->abs2rel('/.','/t1/t2/t3')",                 '../../..'           ],
[  "Cygwin->abs2rel('/./','/t1/t2/t3')",                '../../..'           ],
#[ "Cygwin->abs2rel('../t4','/t1/t2/t3')",              '../t4'              ],
[  "Cygwin->abs2rel('/t1/t2/t3', '/')",                 't1/t2/t3'           ],
[  "Cygwin->abs2rel('/t1/t2/t3', '/t1')",               't2/t3'              ],
[  "Cygwin->abs2rel('t1/t2/t3', 't1')",                 't2/t3'              ],
[  "Cygwin->abs2rel('t1/t2/t3', 't4')",                 '../t1/t2/t3'        ],

[ "Cygwin->rel2abs('t4','/t1/t2/t3')",             '/t1/t2/t3/t4'    ],
[ "Cygwin->rel2abs('t4/t5','/t1/t2/t3')",          '/t1/t2/t3/t4/t5' ],
[ "Cygwin->rel2abs('.','/t1/t2/t3')",              '/t1/t2/t3'       ],
[ "Cygwin->rel2abs('..','/t1/t2/t3')",             '/t1/t2/t3/..'    ],
[ "Cygwin->rel2abs('../t4','/t1/t2/t3')",          '/t1/t2/t3/../t4' ],
[ "Cygwin->rel2abs('/t1','/t1/t2/t3')",            '/t1'             ],
[ "Cygwin->rel2abs('//t1/t2/t3','/foo')",          '//t1/t2/t3'      ],

) ;

my $test_count = scalar @tests;

plan tests => scalar @tests;

{
    package File::Spec::FakeWin32;
    use vars qw(@ISA);
    @ISA = qw(File::Spec::Win32);

    sub _cwd { 'C:\\one\\two' }

    # Some funky stuff to override Cwd::getdcwd() for testing purposes,
    # in the limited scope of the rel2abs() method.
    if ($Cwd::VERSION && $Cwd::VERSION gt '2.17') {  # Avoid a 'used only once' warning
	local $^W;
	*rel2abs = sub {
	    my $self = shift;
	    local $^W;
	    local *Cwd::getdcwd = sub {
	      return 'D:\alpha\beta' if $_[0] eq 'D:';
	      return 'C:\one\two'    if $_[0] eq 'C:';
	      return;
	    };
	    *Cwd::getdcwd = *Cwd::getdcwd; # Avoid a 'used only once' warning
	    return $self->SUPER::rel2abs(@_);
	};
	*rel2abs = *rel2abs; # Avoid a 'used only once' warning
    }
}


# Test out the class methods
for ( @tests ) {
   tryfunc( @$_ ) ;
}


#
# Tries a named function with the given args and compares the result against
# an expected result. Works with functions that return scalars or arrays.
#
sub tryfunc {
    my $function = shift ;
    my $expected = shift ;
    my $platform = shift ;

    if ($platform && $^O ne $platform) {
	skip("skip $function", 1);
	return;
    }

    $function =~ s#\\#\\\\#g ;
    $function =~ s/^([^\$].*->)/File::Spec::$1/;
    my $got = join ',', eval $function;

    if ( $@ ) {
      if ( $@ =~ /^\Q$skip_exception/ ) {
	skip "skip $function: $skip_exception", 1;
      }
      else {
	ok $@, '', $function;
      }
      return;
    }

    ok $got, $expected, $function;
}