[Imps] Test cases for parsing spec

Ian Hickson ian at hixie.ch
Wed Dec 6 14:07:20 PST 2006


On Wed, 6 Dec 2006, James Graham wrote:
> 
> Sounds reasonable to me (but I don't claim to be a good arbiter of such 
> things). I think Hixie mentioned the possibility of multiple tests per 
> file with some way of separating them, although I notice both the feed 
> parser and validator have one test per file.

I can output the test/result pairs I have to whatever form, it just seems 
like a single file would be easier to manage.

For what it's worth, the format needs to be such that if this file:

   <html><head></head><body></body></html>

...gets parsed as a single text node, the output isn't:

   <html><head></head><body></body></html>

...if that's also what the "correct" output is.

One of the formats I've used has output of the entire DOM, with the list 
of errors, and each DOM node on its own line with nesting indicated by 
indents, in this form:

Data: Line1<br>Line2<br>Line3<br>Line4
7: Parse error: missing document type declaration. (3)
#document
| <html>
|   <head>
|   <body>
|     "Line1"
|     <br>
|     "Line2"
|     <br>
|     "Line3"
|     <br>
|     "Line4"

Another form I've used is one where only tags are examined, so the DOM is 
output as a stream of tag names separated by spaces, with nesting 
indicated by the tag name starting with a "/", as in:

{"<a><p><a></a></p></a>", "html head /head body a /a p a /a a /a /p /body /html "}

In both cases I have a bunch of tests per file (the former doesn't support 
newlines in the test data, which is bad).

But anything works, just write a test harness and tell me what form at it 
expects and I'll convert these tests.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the Implementors mailing list