ObjFW  Diff

Differences From Artifact [7815182aa6]:

To Artifact [2c2f0ce2a0]:


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
122
123
124
125
126



127
128
129


130
131
132
133
134
135



136
137

138
139
140
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







-
+
-
-
-
-
-
-
+
+
+
+
+
-
-
-




-
-
+
-
-
-
-
+
+
-
-
-
+
+
-
-
-
-
-
+
+
-
-
-
+
+
-
-
-
-
-
+
+
-
-
-
+
+
-
-
-
-
-
-
+
+
+
-
-
-
+
+
-
-
-
-
-
-
+
+
+
-
-
+
-
-

	    @"array", array,
	    @"foo", @"bar",
	    nil]));
}

- (void)testDetectUnsupportedVersion
{
	bool caught = false;
	OTAssertThrowsSpecific(
	@try {
		[[PLIST(@"<string/>")
		    stringByReplacingOccurrencesOfString: @"1.0"
					      withString: @"1.1"]
		objectByParsingPropertyList];
	} @catch (OFUnsupportedVersionException *e) {
	    [[PLIST(@"<string/>")
	    stringByReplacingOccurrencesOfString: @"1.0"
				      withString: @"1.1"]
	    objectByParsingPropertyList],
	    OFUnsupportedVersionException);
		caught = true;
	}
	OTAssertTrue(caught);
}

- (void)testDetectInvalidFormat
{
	bool caught;

	OTAssertThrowsSpecific(
	caught = false;
	@try {
		[PLIST(@"<string x='b'/>") objectByParsingPropertyList];
	} @catch (OFInvalidFormatException *e) {
	    [PLIST(@"<string x='b'/>") objectByParsingPropertyList],
	    OFInvalidFormatException);
		caught = true;
	}
	OTAssertTrue(caught);

	OTAssertThrowsSpecific(

	caught = false;
	@try {
		[PLIST(@"<string xmlns='foo'/>") objectByParsingPropertyList];
	} @catch (OFInvalidFormatException *e) {
	    [PLIST(@"<string xmlns='foo'/>") objectByParsingPropertyList],
	    OFInvalidFormatException);
		caught = true;
	}
	OTAssertTrue(caught);

	OTAssertThrowsSpecific(

	caught = false;
	@try {
		[PLIST(@"<dict count='0'/>") objectByParsingPropertyList];
	} @catch (OFInvalidFormatException *e) {
	    [PLIST(@"<dict count='0'/>") objectByParsingPropertyList],
	    OFInvalidFormatException);
		caught = true;
	}
	OTAssertTrue(caught);

	OTAssertThrowsSpecific(

	caught = false;
	@try {
		[PLIST(@"<dict><key/><string/><key/></dict>")
		    objectByParsingPropertyList];
	} @catch (OFInvalidFormatException *e) {
	    [PLIST(@"<dict><key/><string/><key/></dict>")
	    objectByParsingPropertyList],
	    OFInvalidFormatException);
		caught = true;
	}
	OTAssertTrue(caught);

	OTAssertThrowsSpecific(

	caught = false;
	@try {
		[PLIST(@"<dict><key x='x'/><string/></dict>")
		    objectByParsingPropertyList];
	} @catch (OFInvalidFormatException *e) {
	    [PLIST(@"<dict><key x='x'/><string/></dict>")
	    objectByParsingPropertyList],
	    OFInvalidFormatException);
		caught = true;
	}
}
	OTAssertTrue(caught);
}
@end