var fs=require("fs");var path=require("path");var assert=require("assert");var csso=require("../lib/cssoapi.js");var utils=require("../lib/util.js");var funcs={p:function parse(b,a){return csso.treeToString(clean(b,a))},l:function translate(b,a){return csso.translate(clean(b,a))},cl:function translate(b,a){return csso.translate(clean(b,a,true))}};function parse(b,a){return csso.parse(b,a,true)}function clean(d,c,a){var b=parse(d,c);if(a){b=csso.compress(b)}return utils.cleanInfo(b)}function readFile(a){return fs.readFileSync(a).toString().trim()}function runTest(b,e,d){var f=readFile(e+".css");var c=path.relative(__dirname,e);var g=function(h){it("in "+c,function(){assert.equal(funcs[h](f,d),readFile(e+"."+h))})};for(var a in funcs){if(a in b){g(a)}}}function runTestsInDir(b,d){var c={};fs.readdirSync(b).forEach(function(g){var e=path.extname(g);if(e){var h=path.basename(g,e);if(!c[h]){c[h]={}}c[h][e.substring(1)]=1}});for(var a in c){runTest(c[a],path.join(b,a),d)}}describe("CSSO",function(){var a=path.join(__dirname,"data");fs.readdirSync(a).forEach(function(b){var c=path.join(a,b);var d=fs.statSync(c);if(!d.isDirectory()){return}runTestsInDir(c,b.substring(5))})});