@@ -9,10 +9,11 @@ * the packaging of this file. */ #include "config.h" +#include #include #import "OFXMLParser.h" #import "OFString.h" #import "OFArray.h" @@ -339,10 +340,13 @@ /* Simulate a stream where we only get chunks */ len = strlen(str); for (j = 0; j < len; j+= 2) { + if ([parser finishedParsing]) + abort(); + if (j + 2 > len) [parser parseBuffer: str + j withSize: 1]; else [parser parseBuffer: str + j @@ -349,8 +353,16 @@ withSize: 2]; } TEST(@"Checking if everything was parsed", i == 32) + TEST(@"-[finishedParsing]", [parser finishedParsing]) + + TEST(@"Parsing whitespaces after the document", + R([parser parseString: @" \t\r\n "])) + + EXPECT_EXCEPTION(@"Detection of junk after the document", + OFMalformedXMLException, [parser parseString: @"a"]) + [pool drain]; } @end