@@ -355,10 +355,33 @@ [[[OFIRI IRIWithString: @"http://host/path/component/"] IRIByAppendingPathComponent: @"foo/bar" isDirectory: true] path], @"/path/component/foo/bar/"); } + +- (void)testIRIByDeletingLastPathComponent +{ + OTAssertEqualObjects( + [[[OFIRI IRIWithString: @"http://host/path/component"] + IRIByDeletingLastPathComponent] path], @"/path/"); + + OTAssertEqualObjects( + [[[OFIRI IRIWithString: @"http://host/path/directory/"] + IRIByDeletingLastPathComponent] path], @"/path/"); + + OTAssertEqualObjects( + [[[OFIRI IRIWithString: @"http://host/path"] + IRIByDeletingLastPathComponent] path], @"/"); + + OTAssertEqualObjects( + [[[OFIRI IRIWithString: @"http://host/"] + IRIByDeletingLastPathComponent] path], @"/"); + + OTAssertEqualObjects( + [[[OFIRI IRIWithString: @"http://host"] + IRIByDeletingLastPathComponent] path], @""); +} - (void)testIRIByAddingPercentEncodingForUnicodeCharacters { OTAssertEqualObjects( _IRI[10].IRIByAddingPercentEncodingForUnicodeCharacters,