@@ -643,36 +643,66 @@ #ifdef OF_HAVE_FILES # if defined(OF_WINDOWS) 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: @"c:", @"foo", @"bar", @"baz", nil]] + isEqual: @"c:foo\\bar\\baz"] && + [[stringClass pathWithComponents: [OFArray arrayWithObjects: + @"c:", @"\\", @"foo", @"bar", @"baz", nil]] isEqual: @"c:\\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"] && [[stringClass pathWithComponents: [OFArray arrayWithObject: @"c:"]] - isEqual: @"c:\\"] && + isEqual: @"c:"] && + [[stringClass pathWithComponents: + [OFArray arrayWithObject: @"c:\\"]] isEqual: @"c:\\"] && + [[stringClass pathWithComponents: + [OFArray arrayWithObject: @"\\"]] isEqual: @"\\"] && + [[stringClass pathWithComponents: + [OFArray arrayWithObject: @"/"]] isEqual: @"/"] && [[stringClass pathWithComponents: [OFArray arrayWithObjects: @"\\\\", @"foo", @"bar", nil]] isEqual: @"\\\\foo\\bar"]) # elif 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: @"c:", @"foo", @"bar", @"baz", nil]] + isEqual: @"c:foo\\bar\\baz"] && + [[stringClass pathWithComponents: [OFArray arrayWithObjects: + @"c:", @"\\", @"foo", @"bar", @"baz", nil]] isEqual: @"c:\\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"] && [[stringClass pathWithComponents: [OFArray arrayWithObject: @"c:"]] - isEqual: @"c:\\"]) + isEqual: @"c:"] && + [[stringClass pathWithComponents: + [OFArray arrayWithObject: @"c:\\"]] isEqual: @"c:\\"] && + [[stringClass pathWithComponents: + [OFArray arrayWithObject: @"\\"]] isEqual: @"\\"] && + [[stringClass pathWithComponents: + [OFArray arrayWithObject: @"/"]] isEqual: @"/"]) # elif defined(OF_AMIGAOS) TEST(@"+[pathWithComponents:]", [[stringClass pathWithComponents: [OFArray arrayWithObjects: @"dh0:", @"foo", @"bar", @"baz", nil]] isEqual: @"dh0:foo/bar/baz"] && @@ -712,18 +742,24 @@ # if defined(OF_WINDOWS) TEST(@"-[pathComponents]", /* c:/tmp */ (a = C(@"c:/tmp").pathComponents) && a.count == 2 && - [[a objectAtIndex: 0] isEqual: @"c:"] && + [[a objectAtIndex: 0] isEqual: @"c:/"] && [[a objectAtIndex: 1] isEqual: @"tmp"] && /* c:\tmp\ */ (a = C(@"c:\\tmp\\").pathComponents) && a.count == 2 && - [[a objectAtIndex: 0] isEqual: @"c:"] && + [[a objectAtIndex: 0] isEqual: @"c:\\"] && [[a objectAtIndex: 1] isEqual: @"tmp"] && + /* c:\ */ + (a = C(@"c:\\").pathComponents) && a.count == 1 && + [[a objectAtIndex: 0] isEqual: @"c:\\"] && /* c:/ */ (a = C(@"c:/").pathComponents) && a.count == 1 && + [[a objectAtIndex: 0] isEqual: @"c:/"] && + /* c: */ + (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"] && @@ -743,18 +779,24 @@ C(@"").pathComponents.count == 0) # elif defined(OF_MSDOS) TEST(@"-[pathComponents]", /* c:/tmp */ (a = C(@"c:/tmp").pathComponents) && a.count == 2 && - [[a objectAtIndex: 0] isEqual: @"c:"] && + [[a objectAtIndex: 0] isEqual: @"c:/"] && [[a objectAtIndex: 1] isEqual: @"tmp"] && /* c:\tmp\ */ (a = C(@"c:\\tmp\\").pathComponents) && a.count == 2 && - [[a objectAtIndex: 0] isEqual: @"c:"] && + [[a objectAtIndex: 0] isEqual: @"c:\\"] && [[a objectAtIndex: 1] isEqual: @"tmp"] && + /* c:\ */ + (a = C(@"c:\\").pathComponents) && a.count == 1 && + [[a objectAtIndex: 0] isEqual: @"c:\\"] && /* c:/ */ (a = C(@"c:/").pathComponents) && a.count == 1 && + [[a objectAtIndex: 0] isEqual: @"c:/"] && + /* c: */ + (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"] && @@ -849,11 +891,11 @@ 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(@"\\").lastPathComponent isEqual: @"\\"] && [C(@"foo").lastPathComponent isEqual: @"foo"] && [C(@"foo\\bar").lastPathComponent isEqual: @"bar"] && [C(@"foo/bar/baz/").lastPathComponent isEqual: @"baz"] && [C(@"\\\\foo\\bar").lastPathComponent isEqual: @"bar"] && [C(@"\\\\").lastPathComponent isEqual: @"\\\\"]) @@ -861,11 +903,11 @@ 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(@"\\").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]", @@ -901,36 +943,36 @@ [C(@"foo/.bar.baz").pathExtension isEqual: @"baz"] && [C(@"foo/bar.baz/").pathExtension isEqual: @"baz"]) # if defined(OF_WINDOWS) TEST(@"-[stringByDeletingLastPathComponent]", - [C(@"\\tmp").stringByDeletingLastPathComponent isEqual: @""] && - [C(@"/tmp/").stringByDeletingLastPathComponent isEqual: @""] && + [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(@"\\").stringByDeletingLastPathComponent isEqual: @"\\"] && [C(@"foo").stringByDeletingLastPathComponent isEqual: @"."] && [C(@"\\\\foo\\bar").stringByDeletingLastPathComponent isEqual: @"\\\\foo"] && [C(@"\\\\foo").stringByDeletingLastPathComponent isEqual: @"\\\\"] && [C(@"\\\\").stringByDeletingLastPathComponent isEqual: @"\\\\"]) # elif defined(OF_MSDOS) TEST(@"-[stringByDeletingLastPathComponent]", - [C(@"\\tmp").stringByDeletingLastPathComponent isEqual: @""] && - [C(@"/tmp/").stringByDeletingLastPathComponent isEqual: @""] && + [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(@"\\").stringByDeletingLastPathComponent isEqual: @"\\"] && [C(@"foo").stringByDeletingLastPathComponent isEqual: @"."]) # elif defined(OF_AMIGAOS) TEST(@"-[stringByDeletingLastPathComponent]", [C(@"dh0:").stringByDeletingLastPathComponent isEqual: @"dh0:"] && [C(@"dh0:tmp").stringByDeletingLastPathComponent @@ -1017,11 +1059,13 @@ # ifdef OF_WINDOWS /* TODO: Add more tests */ TEST(@"-[stringByStandardizingPath]", [C(@"\\\\foo\\..\\bar\\qux").stringByStandardizingPath - isEqual: @"\\\\bar\\qux"]) + isEqual: @"\\\\bar\\qux"] && + [C(@"c:\\..\\asd").stringByStandardizingPath + isEqual: @"c:\\..\\asd"]) # endif #endif TEST(@"-[decimalValue]", C(@"1234").decimalValue == 1234 &&