title: Is there a CSS syntax test suite?
body: <p>I'm writing a custom CSS parser and want to use it to style graphical elements in my application (not HTML). I want to make sure that this conforms to the usual CSS behavior when it comes to precedence of selectors, the "cascade", etc..</p>
  
  <p><strong>Is there a comprehensive CSS test suite I can use for this project?</strong></p>
  
  <p>My CSS has most of the regular syntax features (e.g. matches "tag" names, ids, classes, pseudoclasses) and will share many of the formatting options with HTML's CSS, but also have different ones, as appropriate for the kind of "documents" I'm styling.</p>
  
  <p>I've been looking for a CSS test suite to check my implementation, but the only ones I could find, like the <a href="http://www.w3.org/Style/CSS/Test/" rel="nofollow">W3C test suite</a>, are primarily concerned with the visual representation of the document. I'm looking for something that is machine-readable or easy to adapt, and exercises the CSS engine rather than the layout engine. Something like (pseudo-test-specification):</p>
  
  <pre><code>Stylesheet
      blah.blub { color: red; }
      .blub { color: blue; }
  
  + Document
      &lt;blah class="blub" /&gt;
  
  =&gt; Expected result:
      &lt;blah class="blub" style="color: red" /&gt;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>assert selector "#blub" matches element "moo#blub"
  assert selector "blah#blub" does not match element "moo#blub"
  ...
  </code></pre>
  
  <p>I'd also like to test the behavior of CSS shorthands (e.g. <code>line</code> vs <code>line-color</code>), in cases I've implemented them identical to HTML's. For example</p>
  
  <pre><code>line: 1px solid blue;
  line-color: red;
  </code></pre>
  
  <p>results in a "1px solid red" line. Any ideas?</p>