Re: Testing CSS tokenization

On 6/17/13 10:40 PM, Simon Sapin wrote:
> Hi,
>
> So, I’ve been implementing the new CSS Syntax draft:
>
> http://dev.w3.org/csswg/css-syntax/
> https://github.com/SimonSapin/tinycss2
>
> And of course, I’m writing tests. This time around, I’m writing them 
> in JSON in the hope to share them in multiple implementations. (I’m 
> working on at least two of them myself.)
>
> https://github.com/SimonSapin/tinycss2/tree/master/tinycss2/tests
> (This is very much "in progress", but I hope you get the idea.)
>
>
> In order to test tokenization, I really want to look at the output of 
> the tokenizer. (Actually the output of "Parse a list of component 
> values", which is close enough.) Unfortunately, the tokenizer is not 
> exposed on the web. I can not take these tests and run them in any 
> browsers; this would require writing custom code against the browser’s 
> source code. I understand this is not acceptable for a W3C spec’s test 
> suite, but anything else has to be much higher level and I don’t find 
> it very satisfying.
>
> For example, many corner cases of the tokenizer are not tested AFAICT 
> by the 2.1:
>
> http://hg.csswg.org/test/file/63d1b51beff2/approved/css2.1/src/syntax
>
>
> What do you think? What is the way to test a spec such as CSS Syntax 
> whose product is not directly exposed to the web platform?
>
> Cheers,
Having tokenizer tests and checking the output of the tokenizer directly 
seems like a useful thing for implementers. html5lib has that as well. 
As you say, it's not of much use to assess conformance for the spec 
since an implementation might be conforming in Web-observable ways but 
doesn't exactly match the spec's tokenizer, and that should be fine.

I don't know what the test policy is for CSS, but my knee-jerk reaction 
is that it seems like a good idea to include the tests but mark them as 
optional for conformance.

It would also be useful to have tests that test the requirements in the 
spec's tokenizer but in a way that is observable to the Web. Such tests 
would be usable to assess conformance.

-- 
Simon Pieters
Opera Software

Received on Tuesday, 18 June 2013 06:30:11 UTC