556
557
558
559
560
561
562
563
564
565
566
567
568
569
|
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
|
+
+
+
+
+
|
TEST(@"-[isAbsolutePath]",
[C(@"C:\\foo") isAbsolutePath] && [C(@"a:/foo") isAbsolutePath] &&
![C(@"foo") isAbsolutePath] && ![C(@"b:foo") isAbsolutePath])
# elif defined(OF_AMIGAOS)
TEST(@"-[isAbsolutePath]",
[C(@"dh0:foo") isAbsolutePath] && [C(@"dh0:a/b") isAbsolutePath] &&
![C(@"foo/bar") isAbsolutePath] && ![C(@"foo") isAbsolutePath])
# elif defined(OF_NINTENDO_3DS)
TEST(@"-[isAbsolutePath]",
[C(@"sdmc:/foo") isAbsolutePath] &&
![C(@"sdmc:foo") isAbsolutePath] &&
![C(@"foo/bar") isAbsolutePath] && ![C(@"foo") isAbsolutePath])
# else
TEST(@"-[isAbsolutePath]",
[C(@"/foo") isAbsolutePath] && [C(@"/foo/bar") isAbsolutePath] &&
![C(@"foo/bar") isAbsolutePath] && ![C(@"foo") isAbsolutePath])
# endif
s[0] = [mutableStringClass stringWithString: @"foo"];
|
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
|
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
|
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
[a count] == i)
#ifdef OF_HAVE_FILES
# if defined(OF_WINDOWS) || defined(OF_MSDOS)
TEST(@"+[pathWithComponents:]",
[[stringClass pathWithComponents: [OFArray arrayWithObjects:
@"foo", @"bar", @"baz", nil]] isEqual: @"foo\\bar\\baz"] &&
[[stringClass pathWithComponents: [OFArray arrayWithObjects:
@"c:", @"foo", @"bar", @"baz", nil]]
isEqual: @"c:\\foo\\bar\\baz"] &&
[[stringClass pathWithComponents: [OFArray arrayWithObjects:
@"foo/", @"bar\\", @"", @"baz", @"\\", nil]]
isEqual: @"foo/bar\\baz"] &&
[[stringClass pathWithComponents: [OFArray arrayWithObjects:
@"foo", nil]] isEqual: @"foo"])
@"foo", nil]] isEqual: @"foo"] &&
[[stringClass pathWithComponents: [OFArray arrayWithObject: @"c:"]]
isEqual: @"c:\\"])
# elif defined(OF_AMIGAOS)
TEST(@"+[pathWithComponents:]",
[[stringClass pathWithComponents: [OFArray arrayWithObjects:
@"dh0:", @"foo", @"bar", @"baz", nil]]
isEqual: @"dh0:foo/bar/baz"] &&
[[stringClass pathWithComponents: [OFArray arrayWithObjects:
@"foo", @"bar", @"baz", nil]] isEqual: @"foo/bar/baz"] &&
[[stringClass pathWithComponents: [OFArray arrayWithObjects:
@"foo/", @"bar", @"", @"baz", @"/", nil]]
isEqual: @"foo//bar/baz//"] &&
[[stringClass pathWithComponents: [OFArray arrayWithObjects:
@"foo", nil]] isEqual: @"foo"])
# elif defined(OF_NINTENDO_3DS)
TEST(@"+[pathWithComponents:]",
[[stringClass pathWithComponents: [OFArray arrayWithObjects:
@"foo", @"bar", @"baz", nil]] isEqual: @"foo/bar/baz"] &&
[[stringClass pathWithComponents: [OFArray arrayWithObjects:
@"sdmc:", @"foo", @"bar", @"baz", nil]]
isEqual: @"sdmc:/foo/bar/baz"] &&
[[stringClass pathWithComponents: [OFArray arrayWithObjects:
@"foo/", @"bar/", @"", @"baz", @"/", nil]]
isEqual: @"foo/bar/baz"] &&
[[stringClass pathWithComponents: [OFArray arrayWithObjects:
@"foo", nil]] isEqual: @"foo"] &&
[[stringClass pathWithComponents: [OFArray arrayWithObject:
@"sdmc:"]] isEqual: @"sdmc:/"])
# else
TEST(@"+[pathWithComponents:]",
[[stringClass pathWithComponents: [OFArray arrayWithObjects:
@"/", @"foo", @"bar", @"baz", nil]] isEqual: @"/foo/bar/baz"] &&
[[stringClass pathWithComponents: [OFArray arrayWithObjects:
@"foo", @"bar", @"baz", nil]] isEqual: @"foo/bar/baz"] &&
[[stringClass pathWithComponents: [OFArray arrayWithObjects:
|
739
740
741
742
743
744
745
746
747
748
749
750
751
752
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
[[a objectAtIndex: 1] isEqual: @"bar"] &&
[[a objectAtIndex: 2] isEqual: @"baz"] &&
/* foo// */
(a = [C(@"foo//") pathComponents]) && [a count] == 2 &&
[[a objectAtIndex: 0] isEqual: @"foo"] &&
[[a objectAtIndex: 1] isEqual: @"/"] &&
[[C(@"") pathComponents] count] == 0)
# elif defined(OF_NINTENDO_3DS)
TEST(@"-[pathComponents]",
/* sdmc:/tmp */
(a = [C(@"sdmc:/tmp") pathComponents]) && [a count] == 2 &&
[[a objectAtIndex: 0] isEqual: @"sdmc:"] &&
[[a objectAtIndex: 1] isEqual: @"tmp"] &&
/* sdmc:/ */
(a = [C(@"sdmc:/") pathComponents]) && [a count] == 1 &&
[[a objectAtIndex: 0] isEqual: @"sdmc:"] &&
/* foo/bar */
(a = [C(@"foo/bar") pathComponents]) && [a count] == 2 &&
[[a objectAtIndex: 0] isEqual: @"foo"] &&
[[a objectAtIndex: 1] isEqual: @"bar"] &&
/* foo/bar/baz/ */
(a = [C(@"foo/bar/baz/") pathComponents]) && [a count] == 3 &&
[[a objectAtIndex: 0] isEqual: @"foo"] &&
[[a objectAtIndex: 1] isEqual: @"bar"] &&
[[a objectAtIndex: 2] isEqual: @"baz"] &&
/* foo// */
(a = [C(@"foo//") pathComponents]) && [a count] == 1 &&
[[a objectAtIndex: 0] isEqual: @"foo"] &&
[[C(@"") pathComponents] count] == 0)
# else
TEST(@"-[pathComponents]",
/* /tmp */
(a = [C(@"/tmp") pathComponents]) && [a count] == 2 &&
[[a objectAtIndex: 0] isEqual: @"/"] &&
[[a objectAtIndex: 1] isEqual: @"tmp"] &&
/* /tmp/ */
|
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
|
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
|
+
+
+
+
+
+
+
+
+
+
+
|
[[C(@"") pathComponents] count] == 0)
# endif
# if defined(OF_WINDOWS) || defined(OF_MSDOS)
TEST(@"-[lastPathComponent]",
[[C(@"c:/tmp") lastPathComponent] isEqual: @"tmp"] &&
[[C(@"c:\\tmp\\") lastPathComponent] isEqual: @"tmp"] &&
[[C(@"c:\\") lastPathComponent] isEqual: @"c:\\"] &&
[[C(@"c:/") lastPathComponent] isEqual: @"c:/"] &&
[[C(@"\\") lastPathComponent] isEqual: @""] &&
[[C(@"foo") lastPathComponent] isEqual: @"foo"] &&
[[C(@"foo\\bar") lastPathComponent] isEqual: @"bar"] &&
[[C(@"foo/bar/baz/") lastPathComponent] isEqual: @"baz"])
# elif defined(OF_AMIGAOS)
TEST(@"-[lastPathComponent]",
[[C(@"dh0:tmp") lastPathComponent] isEqual: @"tmp"] &&
[[C(@"dh0:tmp/") lastPathComponent] isEqual: @"tmp"] &&
[[C(@"dh0:/") lastPathComponent] isEqual: @"/"] &&
[[C(@"dh0:") lastPathComponent] isEqual: @"dh0:"] &&
[[C(@"foo") lastPathComponent] isEqual: @"foo"] &&
[[C(@"foo/bar") lastPathComponent] isEqual: @"bar"] &&
[[C(@"foo/bar/baz/") lastPathComponent] isEqual: @"baz"])
# elif defined(OF_NINTENDO_3DS)
TEST(@"-[lastPathComponent]",
[[C(@"sdmc:/tmp") lastPathComponent] isEqual: @"tmp"] &&
[[C(@"sdmc:/tmp/") lastPathComponent] isEqual: @"tmp"] &&
[[C(@"sdmc:/") lastPathComponent] isEqual: @"sdmc:/"] &&
[[C(@"sdmc:") lastPathComponent] isEqual: @"sdmc:"] &&
[[C(@"foo") lastPathComponent] isEqual: @"foo"] &&
[[C(@"foo/bar") lastPathComponent] isEqual: @"bar"] &&
[[C(@"foo/bar/baz/") lastPathComponent] isEqual: @"baz"])
# else
TEST(@"-[lastPathComponent]",
[[C(@"/tmp") lastPathComponent] isEqual: @"tmp"] &&
[[C(@"/tmp/") lastPathComponent] isEqual: @"tmp"] &&
|
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
|
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
|
+
+
+
+
+
+
+
+
+
+
+
+
+
|
[[C(@"foo/.bar.baz") pathExtension] isEqual: @"baz"] &&
[[C(@"foo/bar.baz/") pathExtension] isEqual: @"baz"])
# if defined(OF_WINDOWS) || defined(OF_MSDOS)
TEST(@"-[stringByDeletingLastPathComponent]",
[[C(@"\\tmp") stringByDeletingLastPathComponent] isEqual: @""] &&
[[C(@"/tmp/") stringByDeletingLastPathComponent] isEqual: @""] &&
[[C(@"c:\\") stringByDeletingLastPathComponent] isEqual: @"c:\\"] &&
[[C(@"c:/") stringByDeletingLastPathComponent] isEqual: @"c:/"] &&
[[C(@"c:\\tmp/foo/") stringByDeletingLastPathComponent]
isEqual: @"c:\\tmp"] &&
[[C(@"foo\\bar") stringByDeletingLastPathComponent]
isEqual: @"foo"] &&
[[C(@"\\") stringByDeletingLastPathComponent] isEqual: @""] &&
[[C(@"foo") stringByDeletingLastPathComponent] isEqual: @"."])
# elif defined(OF_AMIGAOS)
TEST(@"-[stringByDeletingLastPathComponent]",
[[C(@"dh0:") stringByDeletingLastPathComponent] isEqual: @"dh0:"] &&
[[C(@"dh0:tmp") stringByDeletingLastPathComponent]
isEqual: @"dh0:"] &&
[[C(@"dh0:tmp/") stringByDeletingLastPathComponent]
isEqual: @"dh0:"] &&
[[C(@"dh0:/") stringByDeletingLastPathComponent]
isEqual: @"dh0:"] &&
[[C(@"dh0:tmp/foo/") stringByDeletingLastPathComponent]
isEqual: @"dh0:tmp"] &&
[[C(@"foo/bar") stringByDeletingLastPathComponent]
isEqual: @"foo"] &&
[[C(@"foo") stringByDeletingLastPathComponent] isEqual: @""])
# elif defined(OF_NINTENDO_3DS)
TEST(@"-[stringByDeletingLastPathComponent]",
[[C(@"/tmp/") stringByDeletingLastPathComponent] isEqual: @""] &&
[[C(@"sdmc:/tmp/foo/") stringByDeletingLastPathComponent]
isEqual: @"sdmc:/tmp"] &&
[[C(@"sdmc:/") stringByDeletingLastPathComponent]
isEqual: @"sdmc:/"] &&
[[C(@"foo/bar") stringByDeletingLastPathComponent]
isEqual: @"foo"] &&
[[C(@"/") stringByDeletingLastPathComponent] isEqual: @""] &&
[[C(@"foo") stringByDeletingLastPathComponent] isEqual: @"."])
# else
TEST(@"-[stringByDeletingLastPathComponent]",
[[C(@"/tmp") stringByDeletingLastPathComponent] isEqual: @"/"] &&
[[C(@"/tmp/") stringByDeletingLastPathComponent] isEqual: @"/"] &&
[[C(@"/tmp/foo/") stringByDeletingLastPathComponent]
isEqual: @"/tmp"] &&
[[C(@"foo/bar") stringByDeletingLastPathComponent]
|