21
22
23
24
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
|
static OFString *module = @"OFHTTPCookie";
@implementation TestsAppDelegate (OFHTTPCookieTests)
- (void)HTTPCookieTests
{
void *pool = objc_autoreleasePoolPush();
OFURL *URL = [OFURL URLWithString: @"http://heap.zone"];
OFHTTPCookie *cookie[2];
OFArray OF_GENERIC(OFHTTPCookie *) *cookies;
cookie[0] = [OFHTTPCookie cookieWithName: @"foo"
value: @"bar"
domain: @"heap.zone"];
TEST(@"+[cookiesWithResponseHeaderFields:forURL:] #1",
[[OFHTTPCookie cookiesWithResponseHeaderFields: [OFDictionary
dictionaryWithObject: @"foo=bar"
forKey: @"Set-Cookie"] forURL: URL]
isEqual: [OFArray arrayWithObject: cookie[0]]])
cookie[1] = [OFHTTPCookie cookieWithName: @"qux"
value: @"cookie"
domain: @"heap.zone"];
TEST(@"+[cookiesWithResponseHeaderFields:forURL:] #2",
[[OFHTTPCookie cookiesWithResponseHeaderFields: [OFDictionary
dictionaryWithObject: @"foo=bar,qux=cookie"
forKey: @"Set-Cookie"] forURL: URL]
isEqual: [OFArray arrayWithObjects: cookie[0], cookie[1], nil]])
cookie[0].expires = [OFDate dateWithTimeIntervalSince1970: 1234567890];
|
|
|
|
|
21
22
23
24
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
|
static OFString *module = @"OFHTTPCookie";
@implementation TestsAppDelegate (OFHTTPCookieTests)
- (void)HTTPCookieTests
{
void *pool = objc_autoreleasePoolPush();
OFURL *URL = [OFURL URLWithString: @"http://nil.im"];
OFHTTPCookie *cookie[2];
OFArray OF_GENERIC(OFHTTPCookie *) *cookies;
cookie[0] = [OFHTTPCookie cookieWithName: @"foo"
value: @"bar"
domain: @"nil.im"];
TEST(@"+[cookiesWithResponseHeaderFields:forURL:] #1",
[[OFHTTPCookie cookiesWithResponseHeaderFields: [OFDictionary
dictionaryWithObject: @"foo=bar"
forKey: @"Set-Cookie"] forURL: URL]
isEqual: [OFArray arrayWithObject: cookie[0]]])
cookie[1] = [OFHTTPCookie cookieWithName: @"qux"
value: @"cookie"
domain: @"nil.im"];
TEST(@"+[cookiesWithResponseHeaderFields:forURL:] #2",
[[OFHTTPCookie cookiesWithResponseHeaderFields: [OFDictionary
dictionaryWithObject: @"foo=bar,qux=cookie"
forKey: @"Set-Cookie"] forURL: URL]
isEqual: [OFArray arrayWithObjects: cookie[0], cookie[1], nil]])
cookie[0].expires = [OFDate dateWithTimeIntervalSince1970: 1234567890];
|