Unit tests for LESS/SCSS

Also fixes for #8894 and #8895.
Why was handling of `@rule ... ;` and `@rule ... { ... }` formats combined like this? I can't think of a case off the top-of-my-head that causes a problem, but CSS is still evolving, and it doesn't seem very much code is saved here, so this seems risky.