ObjFW  Check-in [9d48ed225c]

Overview
Comment:Fix -[OFURL isEqual:].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9d48ed225cc683039af0c8f41f2f73ad29ecf5b5ff796c91dec81aa4c68d5b77
User & Date: js on 2011-06-04 13:29:35
Other Links: manifest | tags
Context
2011-06-04
13:34
Remove useless casts. check-in: 675eda4ad3 user: js tags: trunk
13:29
Fix -[OFURL isEqual:]. check-in: 9d48ed225c user: js tags: trunk
2011-06-03
15:14
Add deserialization. check-in: dca3061dfc user: js tags: trunk
Changes

Modified src/OFURL.m from [35c5ed8137] to [fb49e7ba43].

339
340
341
342
343
344
345
346
347

348
349
350
351

352
353

354
355

356
357
358
359
360
361
362
363

	if (![otherURL->scheme isEqual: scheme])
		return NO;
	if (![otherURL->host isEqual: host])
		return NO;
	if (otherURL->port != port)
		return NO;
	if (![otherURL->user isEqual: user])
		return NO;

	if (![otherURL->password isEqual: password])
		return NO;
	if (![otherURL->path isEqual: path])
		return NO;

	if (![otherURL->parameters isEqual: parameters])
		return NO;

	if (![otherURL->query isEqual: query])
		return NO;

	if (![otherURL->fragment isEqual: fragment])
		return NO;

	return YES;
}

- (uint32_t)hash
{







|

>
|



>
|

>
|

>
|







339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367

	if (![otherURL->scheme isEqual: scheme])
		return NO;
	if (![otherURL->host isEqual: host])
		return NO;
	if (otherURL->port != port)
		return NO;
	if (otherURL->user != user && ![otherURL->user isEqual: user])
		return NO;
	if (otherURL->password != password &&
	    ![otherURL->password isEqual: password])
		return NO;
	if (![otherURL->path isEqual: path])
		return NO;
	if (otherURL->parameters != parameters &&
	    ![otherURL->parameters isEqual: parameters])
		return NO;
	if (otherURL->query != query &&
	    ![otherURL->query isEqual: query])
		return NO;
	if (otherURL->fragment != fragment &&
	    ![otherURL->fragment isEqual: fragment])
		return NO;

	return YES;
}

- (uint32_t)hash
{

Modified tests/OFURLTests.m from [030d169ca8] to [8b94bb792f].

71
72
73
74
75
76
77
78

79
80
81
82
83
84
85
86
87
88
89
	    [[u1 parameters] isEqual: @"p"] && [u4 parameters] == nil)
	TEST(@"-[query]", [[u1 query] isEqual: @"q"] && [u4 query] == nil)
	TEST(@"-[fragment]",
	    [[u1 fragment] isEqual: @"f"] && [u4 fragment] == nil)

	TEST(@"-[copy]", R(u4 = [[u1 copy] autorelease]))

	TEST(@"-[isEqual:]", [u1 isEqual: u4] && ![u2 isEqual: u3])

	TEST(@"-[hash:]", [u1 hash] == [u4 hash] && [u2 hash] != [u3 hash])

	EXPECT_EXCEPTION(@"Detection of invalid format",
	    OFInvalidFormatException, [OFURL URLWithString: @"http"])

	EXPECT_EXCEPTION(@"Detection of invalid scheme",
	    OFInvalidFormatException, [OFURL URLWithString: @"foo://"])

	[pool drain];
}
@end







|
>











71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
	    [[u1 parameters] isEqual: @"p"] && [u4 parameters] == nil)
	TEST(@"-[query]", [[u1 query] isEqual: @"q"] && [u4 query] == nil)
	TEST(@"-[fragment]",
	    [[u1 fragment] isEqual: @"f"] && [u4 fragment] == nil)

	TEST(@"-[copy]", R(u4 = [[u1 copy] autorelease]))

	TEST(@"-[isEqual:]", [u1 isEqual: u4] && ![u2 isEqual: u3] &&
	    [[OFURL URLWithString: @"http://bar/"] isEqual: u3])
	TEST(@"-[hash:]", [u1 hash] == [u4 hash] && [u2 hash] != [u3 hash])

	EXPECT_EXCEPTION(@"Detection of invalid format",
	    OFInvalidFormatException, [OFURL URLWithString: @"http"])

	EXPECT_EXCEPTION(@"Detection of invalid scheme",
	    OFInvalidFormatException, [OFURL URLWithString: @"foo://"])

	[pool drain];
}
@end