@@ -813,6 +813,19 @@ final class StringTests : XCTestCase {
813
813
}
814
814
}
815
815
816
+ func testAppendingPathExtension( ) {
817
+ XCTAssertEqual ( " " . appendingPathExtension ( " foo " ) , " .foo " )
818
+ XCTAssertEqual ( " / " . appendingPathExtension ( " foo " ) , " /.foo " )
819
+ XCTAssertEqual ( " // " . appendingPathExtension ( " foo " ) , " //.foo " )
820
+ XCTAssertEqual ( " /path " . appendingPathExtension ( " foo " ) , " /path.foo " )
821
+ XCTAssertEqual ( " /path.zip " . appendingPathExtension ( " foo " ) , " /path.zip.foo " )
822
+ XCTAssertEqual ( " /path/ " . appendingPathExtension ( " foo " ) , " /path.foo/ " )
823
+ XCTAssertEqual ( " /path// " . appendingPathExtension ( " foo " ) , " /path.foo/ " )
824
+ XCTAssertEqual ( " path " . appendingPathExtension ( " foo " ) , " path.foo " )
825
+ XCTAssertEqual ( " path/ " . appendingPathExtension ( " foo " ) , " path.foo/ " )
826
+ XCTAssertEqual ( " path// " . appendingPathExtension ( " foo " ) , " path.foo/ " )
827
+ }
828
+
816
829
func testDeletingPathExtenstion( ) {
817
830
XCTAssertEqual ( " " . deletingPathExtension ( ) , " " )
818
831
XCTAssertEqual ( " / " . deletingPathExtension ( ) , " / " )
@@ -835,6 +848,15 @@ final class StringTests : XCTestCase {
835
848
XCTAssertEqual ( " /foo.bar/bar.baz/baz.zip " . deletingPathExtension ( ) , " /foo.bar/bar.baz/baz " )
836
849
XCTAssertEqual ( " /.././.././a.zip " . deletingPathExtension ( ) , " /.././.././a " )
837
850
XCTAssertEqual ( " /.././.././. " . deletingPathExtension ( ) , " /.././.././. " )
851
+
852
+ XCTAssertEqual ( " path.foo " . deletingPathExtension ( ) , " path " )
853
+ XCTAssertEqual ( " path.foo.zip " . deletingPathExtension ( ) , " path.foo " )
854
+ XCTAssertEqual ( " /path.foo " . deletingPathExtension ( ) , " /path " )
855
+ XCTAssertEqual ( " /path.foo.zip " . deletingPathExtension ( ) , " /path.foo " )
856
+ XCTAssertEqual ( " path.foo/ " . deletingPathExtension ( ) , " path/ " )
857
+ XCTAssertEqual ( " path.foo// " . deletingPathExtension ( ) , " path/ " )
858
+ XCTAssertEqual ( " /path.foo/ " . deletingPathExtension ( ) , " /path/ " )
859
+ XCTAssertEqual ( " /path.foo// " . deletingPathExtension ( ) , " /path/ " )
838
860
}
839
861
840
862
func testPathComponents( ) {
0 commit comments