FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
IRWebAPIKit/IRWebAPIKitTest.m at develop · iridia/IRWebAPIKit · GitHub
iridia
IRWebAPIKit
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
IRWebAPIKit
/
IRWebAPIKitTest.m
Copy path
More file actions
More file actions
Latest commit
History
History
History
115 lines (67 loc) · 2.08 KB
Breadcrumbs
IRWebAPIKit
/
IRWebAPIKitTest.m
Copy path
File metadata and controls
115 lines (67 loc) · 2.08 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
//
//
IRWebAPIKitTest.m
//
IRWebAPIKit
//
//
Created by Evadne Wu on 3/13/12.
//
Copyright (c) 2012 Iridia Productions. All rights reserved.
//
#
import
"
IRWebAPIKitTest.h
"
#
import
"
IRWebAPIHelpers.h
"
@implementation
IRWebAPIKitTest
- (
void
)
testHTMLEntitiesDecoding
{
NSDictionary
*originalToDecoded = [
NSDictionary
dictionaryWithObjectsAndKeys:
@"
<
"
,
@"
<
"
,
nil
];
for
(
id
aKey in originalToDecoded) {
NSString
*libraryDecoded =
IRWebAPIStringByDecodingXMLEntities
(aKey);
STAssertEqualObjects
(
[originalToDecoded
objectForKey:
aKey],
libraryDecoded,
@"
Library-decoded string does not match the sample.
"
);
}
}
- (
void
)
testRFC3986StringEncoding
{
//
Still at odds with this.
NSDictionary
*originalToEncoded = [
NSDictionary
dictionaryWithObjectsAndKeys:
@"
%25%
21
%24%
26
%27%
28
%29%
2A%2B
%2C%2F%3A
%3B
%3D%3F
%40
"
,
@"
%!$&'()*+,/:;=?@
"
,
nil
];
for
(
id
aKey in originalToEncoded) {
NSString
*libraryEncoded =
IRWebAPIKitRFC3986EncodedStringMake
(aKey);
STAssertEqualObjects
(
[originalToEncoded
objectForKey:
aKey],
libraryEncoded,
@"
Library-encoded string does not match the sample.
"
);
STAssertEqualObjects
(
IRWebAPIKitRFC3986DecodedStringMake
(libraryEncoded),
aKey,
@"
Decoded library-encoded string does not match the sample.
"
);
}
}
- (
void
)
testQueryDecoding
{
NSDictionary
*testData = [
NSDictionary
dictionaryWithObjectsAndKeys:
[
NSDictionary
dictionaryWithObjectsAndKeys:
@"
v
"
,
@"
k
"
,
nil
],
@"
k=v
"
,
[
NSDictionary
dictionaryWithObjectsAndKeys:
@"
v1
"
,
@"
k1
"
,
@"
"
,
@"
k2
"
,
nil
],
@"
k1=v1&k2=
"
,
[
NSDictionary
dictionaryWithObjectsAndKeys:
@"
v1
"
,
@"
k1
"
,
@"
v2
"
,
@"
k2
"
,
nil
],
@"
k1=v1&k2=v2
"
,
[
NSDictionary
dictionaryWithObjectsAndKeys:
@"
v1
"
,
@"
k1
"
,
@"
v2
"
,
@"
k2
"
,
@"
v3
"
,
@"
k3
"
,
@"
v4
"
,
@"
k4
"
,
nil
],
@"
k1=v1&k2=v2&k3=v3&k4=v4
"
,
nil
];
[testData
enumerateKeysAndObjectsUsingBlock:
^(
id
key,
id
obj,
BOOL
*stop) {
STAssertEqualObjects
(
IRQueryParametersFromString
(key), obj,
@"
Decoded object from string
%@
must match structure
%@
"
, key, obj);
}];
}
@end
Back
|
FazBrowse Home
|
New Git URL