Differences From Artifact [ef05512ace]:
- File
tests/OFHTTPCookieManagerTests.m
— part of check-in
[09be825f88]
at
2019-09-29 15:58:33
on branch trunk
— Remove OFAutoreleasePool
OFAutoreleasePools have long been discouraged in favor of the runtime's
autorelease pools. (user: js, size: 3596) [annotate] [blame] [check-ins using] [more...]
To Artifact [0364d9ffbe]:
- File tests/OFHTTPCookieManagerTests.m — part of check-in [0f99128a67] at 2020-01-05 02:05:47 on branch trunk — Update URL in a few places (user: js, size: 3575) [annotate] [blame] [check-ins using] [more...]
1 2 | /* * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, | | | | 1 2 3 4 5 6 7 8 9 10 11 | /* * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, * 2018, 2019, 2020 * Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * |
︙ | ︙ | |||
25 26 27 28 29 30 31 | - (void)HTTPCookieManagerTests { void *pool = objc_autoreleasePoolPush(); OFHTTPCookieManager *manager = [OFHTTPCookieManager manager]; OFURL *URL[4]; OFHTTPCookie *cookie[5]; | | | | | | | | | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | - (void)HTTPCookieManagerTests { void *pool = objc_autoreleasePoolPush(); OFHTTPCookieManager *manager = [OFHTTPCookieManager manager]; OFURL *URL[4]; OFHTTPCookie *cookie[5]; URL[0] = [OFURL URLWithString: @"http://nil.im/foo"]; URL[1] = [OFURL URLWithString: @"https://nil.im/foo/bar"]; URL[2] = [OFURL URLWithString: @"https://test.nil.im/foo/bar"]; URL[3] = [OFURL URLWithString: @"http://webkeks.org/foo/bar"]; cookie[0] = [OFHTTPCookie cookieWithName: @"test" value: @"1" domain: @"nil.im"]; TEST(@"-[addCookie:forURL:] #1", R([manager addCookie: cookie[0] forURL: URL[0]])) TEST(@"-[cookiesForURL:] #1", [[manager cookiesForURL: URL[0]] isEqual: [OFArray arrayWithObject: cookie[0]]]) cookie[1] = [OFHTTPCookie cookieWithName: @"test" value: @"2" domain: @"webkeks.org"]; TEST(@"-[addCookie:forURL:] #2", R([manager addCookie: cookie[1] forURL: URL[0]])) TEST(@"-[cookiesForURL:] #2", [[manager cookiesForURL: URL[0]] isEqual: [OFArray arrayWithObject: cookie[0]]] && [[manager cookiesForURL: URL[3]] isEqual: [OFArray array]]) cookie[2] = [OFHTTPCookie cookieWithName: @"test" value: @"3" domain: @"nil.im"]; cookie[2].secure = true; TEST(@"-[addCookie:forURL:] #3", R([manager addCookie: cookie[2] forURL: URL[1]])) TEST(@"-[cookiesForURL:] #3", [[manager cookiesForURL: URL[1]] isEqual: [OFArray arrayWithObject: cookie[2]]] && [[manager cookiesForURL: URL[0]] isEqual: [OFArray array]]) cookie[2].expires = [OFDate dateWithTimeIntervalSinceNow: -1]; cookie[3] = [OFHTTPCookie cookieWithName: @"test" value: @"4" domain: @"nil.im"]; cookie[3].domain = @".nil.im"; TEST(@"-[addCookie:forURL:] #4", R([manager addCookie: cookie[3] forURL: URL[1]])) TEST(@"-[cookiesForURL:] #4", [[manager cookiesForURL: URL[1]] isEqual: [OFArray arrayWithObject: cookie[3]]] && [[manager cookiesForURL: URL[2]] isEqual: [OFArray arrayWithObject: cookie[3]]]) cookie[4] = [OFHTTPCookie cookieWithName: @"bar" value: @"5" domain: @"test.nil.im"]; TEST(@"-[addCookie:forURL:] #5", R([manager addCookie: cookie[4] forURL: URL[0]])) TEST(@"-[cookiesForURL:] #5", [[manager cookiesForURL: URL[0]] isEqual: [OFArray arrayWithObject: cookie[3]]] && [[manager cookiesForURL: URL[2]] isEqual: |
︙ | ︙ |