Permalink
Browse files

Compare SSS test cases with ideal CSS output

  • Loading branch information...
1 parent 354aed6 commit ac2267146fef61168e241a11202b0634bb6075f2 @ai ai committed Mar 1, 2016
Showing with 18 additions and 3 deletions.
  1. +3 −0 test/cases/comments.css
  2. +9 −1 test/cases/comments.json
  3. +3 −1 test/parse.js
  4. +3 −1 update-cases
@@ -0,0 +1,3 @@
+/* multi
+ line */
+/* inline*/
@@ -53,5 +53,13 @@
"line": 1,
"column": 1
}
- }
+ },
+ "rawCache": {
+ "beforeRule": "\n",
+ "beforeDecl": "\n",
+ "beforeComment": "\n",
+ "indent": " "
+ },
+ "lastEach": 4,
+ "indexes": {}
}
View
@@ -24,9 +24,11 @@ function read(file) {
for ( let name of tests ) {
test('parses ' + name, t => {
- let sss = read(name).trim();
+ let sss = read(name);
+ let css = read(name.replace(/\.sss/, '.css')).trim();
let json = read(name.replace(/\.sss/, '.json')).trim();
let root = parse(sss, { from: name });
+ t.same(root.toString(), css);
t.same(jsonify(root), json);
});
}
View
@@ -11,8 +11,10 @@ fs.readdirSync(dir).filter(function (i) {
return path.extname(i) === '.sss';
}).forEach(function (name) {
var sssFile = path.join(dir, name);
+ var cssFile = sssFile.replace(/\.sss/, '.css');
var jsonFile = sssFile.replace(/\.sss/, '.json');
- var sss = fs.readFileSync(sssFile).toString().trim();
+ var sss = fs.readFileSync(sssFile).toString();
var root = parse(sss, { from: name });
+ fs.writeFileSync(cssFile, root.toString());
fs.writeFileSync(jsonFile, tests.jsonify(root) + '\n');
});

0 comments on commit ac22671

Please sign in to comment.