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
116
117
118
119
|
[OFDate dateWithTimeIntervalSince1970: 1521030896],
[OFNumber numberWithBool: true],
[OFNumber numberWithBool: false],
[OFNumber numberWithFloat: 12.25],
[OFNumber numberWithInt: -10],
nil];
TEST(@"-[propertyListValue:] #1",
[PLIST1.propertyListValue isEqual: @"Hello"])
TEST(@"-[propertyListValue:] #2",
[PLIST2.propertyListValue isEqual: array])
TEST(@"-[propertyListValue:] #3",
[PLIST3.propertyListValue isEqual:
[OFDictionary dictionaryWithKeysAndObjects:
@"array", array,
@"foo", @"bar",
nil]])
EXPECT_EXCEPTION(@"-[propertyListValue] detecting unsupported version",
OFUnsupportedVersionException,
[[PLIST(@"<string/>") stringByReplacingOccurrencesOfString: @"1.0"
withString: @"1.1"]
propertyListValue])
EXPECT_EXCEPTION(
@"-[propertyListValue] detecting invalid format #1",
OFInvalidFormatException,
[PLIST(@"<string x='b'/>") propertyListValue])
EXPECT_EXCEPTION(
@"-[propertyListValue] detecting invalid format #2",
OFInvalidFormatException,
[PLIST(@"<string xmlns='foo'/>") propertyListValue])
EXPECT_EXCEPTION(
@"-[propertyListValue] detecting invalid format #3",
OFInvalidFormatException,
[PLIST(@"<dict count='0'/>") propertyListValue])
EXPECT_EXCEPTION(
@"-[propertyListValue] detecting invalid format #4",
OFInvalidFormatException,
[PLIST(@"<dict><key/><string/><key/></dict>") propertyListValue])
EXPECT_EXCEPTION(
@"-[propertyListValue] detecting invalid format #5",
OFInvalidFormatException,
[PLIST(@"<dict><key x='x'/><string/></dict>") propertyListValue])
objc_autoreleasePoolPop(pool);
}
@end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
|
|
>
|
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
116
117
118
119
120
121
|
[OFDate dateWithTimeIntervalSince1970: 1521030896],
[OFNumber numberWithBool: true],
[OFNumber numberWithBool: false],
[OFNumber numberWithFloat: 12.25],
[OFNumber numberWithInt: -10],
nil];
TEST(@"-[objectByParsingPropertyList:] #1",
[PLIST1.objectByParsingPropertyList isEqual: @"Hello"])
TEST(@"-[objectByParsingPropertyList:] #2",
[PLIST2.objectByParsingPropertyList isEqual: array])
TEST(@"-[objectByParsingPropertyList:] #3",
[PLIST3.objectByParsingPropertyList isEqual:
[OFDictionary dictionaryWithKeysAndObjects:
@"array", array,
@"foo", @"bar",
nil]])
EXPECT_EXCEPTION(@"Detecting unsupported version",
OFUnsupportedVersionException,
[[PLIST(@"<string/>") stringByReplacingOccurrencesOfString: @"1.0"
withString: @"1.1"]
objectByParsingPropertyList])
EXPECT_EXCEPTION(
@"-[objectByParsingPropertyList] detecting invalid format #1",
OFInvalidFormatException,
[PLIST(@"<string x='b'/>") objectByParsingPropertyList])
EXPECT_EXCEPTION(
@"-[objectByParsingPropertyList] detecting invalid format #2",
OFInvalidFormatException,
[PLIST(@"<string xmlns='foo'/>") objectByParsingPropertyList])
EXPECT_EXCEPTION(
@"-[objectByParsingPropertyList] detecting invalid format #3",
OFInvalidFormatException,
[PLIST(@"<dict count='0'/>") objectByParsingPropertyList])
EXPECT_EXCEPTION(
@"-[objectByParsingPropertyList] detecting invalid format #4",
OFInvalidFormatException,
[PLIST(@"<dict><key/><string/><key/></dict>")
objectByParsingPropertyList])
EXPECT_EXCEPTION(
@"-[objectByParsingPropertyList] detecting invalid format #5",
OFInvalidFormatException,
[PLIST(@"<dict><key x='x'/><string/></dict>")
objectByParsingPropertyList])
objc_autoreleasePoolPop(pool);
}
@end
|