ObjFW  Diff

Differences From Artifact [78bcb36f91]:

To Artifact [38c5330f76]:


552
553
554
555
556
557
558




559
560
561
562
563
564
565
	    [[C(@"foo") stringByPrependingString: @"bar"] isEqual: @"barfoo"])

#ifdef OF_HAVE_FILES
# if defined(OF_WINDOWS) || defined(OF_MSDOS)
	TEST(@"-[isAbsolutePath]",
	    [C(@"C:\\foo") isAbsolutePath] && [C(@"a:/foo") isAbsolutePath] &&
	    ![C(@"foo") isAbsolutePath] && ![C(@"b: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"];







>
>
>
>







552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
	    [[C(@"foo") stringByPrependingString: @"bar"] isEqual: @"barfoo"])

#ifdef OF_HAVE_FILES
# if defined(OF_WINDOWS) || defined(OF_MSDOS)
	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])
# else
	TEST(@"-[isAbsolutePath]",
	    [C(@"/foo") isAbsolutePath] && [C(@"/foo/bar") isAbsolutePath] &&
	    ![C(@"foo/bar") isAbsolutePath] && ![C(@"foo") isAbsolutePath])
# endif

	s[0] = [mutableStringClass stringWithString: @"foo"];
626
627
628
629
630
631
632












633
634
635
636
637
638
639
	    [[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"])












# 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:







>
>
>
>
>
>
>
>
>
>
>
>







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
	    [[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_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"])
# 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:
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
	    (a = [C(@"c:/") pathComponents]) && [a count] == 1 &&
	    [[a objectAtIndex: 0] isEqual: @"c:"] &&
	    /* 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/ */
	    (a = [C(@"/tmp/") pathComponents]) && [a count] == 2 &&
	    [[a objectAtIndex: 0] isEqual: @"/"] &&
	    [[a objectAtIndex: 1] isEqual: @"tmp"] &&
	    /* / */
	    (a = [C(@"/") pathComponents]) && [a count] == 1 &&
	    [[a objectAtIndex: 0] isEqual: @"/"] &&
	    /* 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)
# endif

# if !defined(OF_WINDOWS) && !defined(OF_MSDOS)
	TEST(@"-[lastPathComponent]",
	    [[C(@"/tmp") lastPathComponent] isEqual: @"tmp"] &&
	    [[C(@"/tmp/") lastPathComponent] isEqual: @"tmp"] &&
	    [[C(@"/") lastPathComponent] isEqual: @"/"] &&
	    [[C(@"foo") lastPathComponent] isEqual: @"foo"] &&
	    [[C(@"foo/bar") lastPathComponent] isEqual: @"bar"] &&
	    [[C(@"foo/bar/baz/") lastPathComponent] isEqual: @"baz"])
# else
	TEST(@"-[lastPathComponent]",
	    [[C(@"c:/tmp") lastPathComponent] isEqual: @"tmp"] &&
	    [[C(@"c:\\tmp\\") lastPathComponent] isEqual: @"tmp"] &&
	    [[C(@"\\") lastPathComponent] isEqual: @""] &&
	    [[C(@"foo") lastPathComponent] isEqual: @"foo"] &&
	    [[C(@"foo\\bar") lastPathComponent] isEqual: @"bar"] &&
	    [[C(@"foo/bar/baz/") lastPathComponent] isEqual: @"baz"])

















# endif

	TEST(@"-[pathExtension]",
	    [[C(@"foo.bar") pathExtension] isEqual: @"bar"] &&
	    [[C(@"foo/.bar") pathExtension] isEqual: @""] &&
	    [[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:\\tmp/foo/") stringByDeletingLastPathComponent]
	    isEqual: @"c:\\tmp"] &&
	    [[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]







|







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


















|









|
<
<
<
<
<
<
<
<







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


















>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
	    (a = [C(@"c:/") pathComponents]) && [a count] == 1 &&
	    [[a objectAtIndex: 0] isEqual: @"c:"] &&
	    /* 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)
# elif defined(OF_AMIGAOS)
	TEST(@"-[pathComponents]",
	    /* dh0:tmp */
	    (a = [C(@"dh0:tmp") pathComponents]) && [a count] == 2 &&
	    [[a objectAtIndex: 0] isEqual: @"dh0:"] &&
	    [[a objectAtIndex: 1] isEqual: @"tmp"] &&
	    /* dh0:tmp/ */
	    (a = [C(@"dh0:tmp/") pathComponents]) && [a count] == 2 &&
	    [[a objectAtIndex: 0] isEqual: @"dh0:"] &&
	    [[a objectAtIndex: 1] isEqual: @"tmp"] &&
	    /* dh0: */
	    (a = [C(@"dh0:/") pathComponents]) && [a count] == 2 &&
	    [[a objectAtIndex: 0] isEqual: @"dh0:"] &&
	    [[a objectAtIndex: 1] isEqual: @"/"] &&
	    /* 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] == 2 &&
	    [[a objectAtIndex: 0] isEqual: @"foo"] &&
	    [[a objectAtIndex: 1] isEqual: @"/"] &&
	    [[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/ */
	    (a = [C(@"/tmp/") pathComponents]) && [a count] == 2 &&
	    [[a objectAtIndex: 0] isEqual: @"/"] &&
	    [[a objectAtIndex: 1] isEqual: @"tmp"] &&
	    /* / */
	    (a = [C(@"/") pathComponents]) && [a count] == 1 &&
	    [[a objectAtIndex: 0] isEqual: @"/"] &&
	    /* 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)
# endif

# if defined(OF_WINDOWS) || defined(OF_MSDOS)








	TEST(@"-[lastPathComponent]",
	    [[C(@"c:/tmp") lastPathComponent] isEqual: @"tmp"] &&
	    [[C(@"c:\\tmp\\") lastPathComponent] isEqual: @"tmp"] &&
	    [[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"])
# else
	TEST(@"-[lastPathComponent]",
	    [[C(@"/tmp") lastPathComponent] isEqual: @"tmp"] &&
	    [[C(@"/tmp/") lastPathComponent] isEqual: @"tmp"] &&
	    [[C(@"/") lastPathComponent] isEqual: @"/"] &&
	    [[C(@"foo") lastPathComponent] isEqual: @"foo"] &&
	    [[C(@"foo/bar") lastPathComponent] isEqual: @"bar"] &&
	    [[C(@"foo/bar/baz/") lastPathComponent] isEqual: @"baz"])
# endif

	TEST(@"-[pathExtension]",
	    [[C(@"foo.bar") pathExtension] isEqual: @"bar"] &&
	    [[C(@"foo/.bar") pathExtension] isEqual: @""] &&
	    [[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:\\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: @""])
# else
	TEST(@"-[stringByDeletingLastPathComponent]",
	    [[C(@"/tmp") stringByDeletingLastPathComponent] isEqual: @"/"] &&
	    [[C(@"/tmp/") stringByDeletingLastPathComponent] isEqual: @"/"] &&
	    [[C(@"/tmp/foo/") stringByDeletingLastPathComponent]
	    isEqual: @"/tmp"] &&
	    [[C(@"foo/bar") stringByDeletingLastPathComponent]
750
751
752
753
754
755
756















757
758
759
760
761
762
763
	    [[C(@"c:/foo.\\bar") stringByDeletingPathExtension]
	    isEqual: @"c:/foo.\\bar"] &&
	    [[C(@"c:\\foo./bar.baz") stringByDeletingPathExtension]
	    isEqual: @"c:\\foo.\\bar"] &&
	    [[C(@"foo.bar/") stringByDeletingPathExtension] isEqual: @"foo"] &&
	    [[C(@".foo") stringByDeletingPathExtension] isEqual: @".foo"] &&
	    [[C(@".foo.bar") stringByDeletingPathExtension] isEqual: @".foo"])















# else
	TEST(@"-[stringByDeletingPathExtension]",
	    [[C(@"foo.bar") stringByDeletingPathExtension] isEqual: @"foo"] &&
	    [[C(@"foo..bar") stringByDeletingPathExtension] isEqual: @"foo."] &&
	    [[C(@"/foo./bar") stringByDeletingPathExtension]
	    isEqual: @"/foo./bar"] &&
	    [[C(@"/foo./bar.baz") stringByDeletingPathExtension]







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
	    [[C(@"c:/foo.\\bar") stringByDeletingPathExtension]
	    isEqual: @"c:/foo.\\bar"] &&
	    [[C(@"c:\\foo./bar.baz") stringByDeletingPathExtension]
	    isEqual: @"c:\\foo.\\bar"] &&
	    [[C(@"foo.bar/") stringByDeletingPathExtension] isEqual: @"foo"] &&
	    [[C(@".foo") stringByDeletingPathExtension] isEqual: @".foo"] &&
	    [[C(@".foo.bar") stringByDeletingPathExtension] isEqual: @".foo"])
# elif defined(OF_AMIGAOS)
	TEST(@"-[stringByDeletingPathExtension]",
	    [[C(@"foo.bar") stringByDeletingPathExtension] isEqual: @"foo"] &&
	    [[C(@"foo..bar") stringByDeletingPathExtension] isEqual: @"foo."] &&
	    [[C(@"dh0:foo.bar") stringByDeletingPathExtension]
	    isEqual: @"dh0:foo"] &&
	    [[C(@"dh0:foo./bar") stringByDeletingPathExtension]
	    isEqual: @"dh0:foo./bar"] &&
	    [[C(@"dh0:foo./bar.baz") stringByDeletingPathExtension]
	    isEqual: @"dh0:foo./bar"] &&
	    [[C(@"foo.bar/") stringByDeletingPathExtension] isEqual: @"foo"] &&
	    [[C(@".foo") stringByDeletingPathExtension] isEqual: @".foo"] &&
	    [[C(@".foo\\bar") stringByDeletingPathExtension]
	    isEqual: @".foo\\bar"] &&
	    [[C(@".foo.bar") stringByDeletingPathExtension] isEqual: @".foo"])
# else
	TEST(@"-[stringByDeletingPathExtension]",
	    [[C(@"foo.bar") stringByDeletingPathExtension] isEqual: @"foo"] &&
	    [[C(@"foo..bar") stringByDeletingPathExtension] isEqual: @"foo."] &&
	    [[C(@"/foo./bar") stringByDeletingPathExtension]
	    isEqual: @"/foo./bar"] &&
	    [[C(@"/foo./bar.baz") stringByDeletingPathExtension]