[Imps] Test cases for parsing spec

Henri Sivonen hsivonen at iki.fi
Thu Dec 7 13:31:03 PST 2006


On Dec 7, 2006, at 20:37, James Graham wrote:

> OK so based on this, I've moved the small number of existing tests  
> we have to a
> json based format like so:
>
> {"tests":
> [
> {"description":"Test description",
> "input":"String to pass to tokenizer",
> "output":[expected_output_tokens]}
> ]
>
> }

This may sound like bikeshedding, but that's not the simplest thing  
that could possibly work.

The simplest thing is:
Test description
String to pass to tokenizer
Output
token
per
line

Next test description after an empty line
Next string to pass to tokenizer
More
output
tokens
with
one
per
line

Lines would be separated by a single LF. LFs in the strings  
themselves would need to be escaped e.g. an \n and a backslash then  
as \\.

(The JSON stuff needs to be parsed first, which means I would need a  
JSON parser for Java. As far as I can tell, the JSON parser for Java  
is not Free Software nor Open Source, which would mean more legal  
stuff to sort out for a project such as the one I am working on which  
is supposed to be Free Software and Open Source. This isn't just my  
reading. IBM wasn't happy with the JSON license, which suggests that  
I shouldn't touch that stuff until it is relicensed under the real  
MIT/expat license.)

-- 
Henri Sivonen
hsivonen at iki.fi
http://hsivonen.iki.fi/





More information about the Implementors mailing list