Commit f4cb0f4e by Dean Mao

Merge pull request #204 from deanmao/master

add test for error status integer, fixed path delimiters in sass.js, and fixed the double .css append in #198
parents dcf76df8 940af24f
...@@ -81,7 +81,11 @@ exports = module.exports = function(args) { ...@@ -81,7 +81,11 @@ exports = module.exports = function(args) {
var outFile = options.outFile = argv.o || argv._[1]; var outFile = options.outFile = argv.o || argv._[1];
if (!outFile) { if (!outFile) {
outFile = options.outFile = path.join(cwd, path.basename(inFile, '.scss') + '.css'); var suffix = '.css';
if (/\.css$/.test(inFile)) {
suffix = '';
}
outFile = options.outFile = path.join(cwd, path.basename(inFile, '.scss') + suffix);
} }
// make sure it's an array. // make sure it's an array.
......
...@@ -74,11 +74,11 @@ exports.render = function(options) { ...@@ -74,11 +74,11 @@ exports.render = function(options) {
options.error = options.error || function(){}; options.error = options.error || function(){};
if (options.file !== undefined && options.file !== null) { if (options.file !== undefined && options.file !== null) {
return binding.renderFile(options.file, options.success, options.error, newOptions.paths.join(':'), newOptions.style, newOptions.comments, options.sourceMap); return binding.renderFile(options.file, options.success, options.error, newOptions.paths.join(path.delimiter), newOptions.style, newOptions.comments, options.sourceMap);
} }
//Assume data is present if file is not. binding/libsass will tell the user otherwise! //Assume data is present if file is not. binding/libsass will tell the user otherwise!
return binding.render(options.data, options.success, options.error, newOptions.paths.join(":"), newOptions.style); return binding.render(options.data, options.success, options.error, newOptions.paths.join(path.delimiter), newOptions.style);
}; };
exports.renderSync = function(options) { exports.renderSync = function(options) {
...@@ -91,11 +91,11 @@ exports.renderSync = function(options) { ...@@ -91,11 +91,11 @@ exports.renderSync = function(options) {
newOptions = prepareOptions(options); newOptions = prepareOptions(options);
if (options.file !== undefined && options.file !== null) { if (options.file !== undefined && options.file !== null) {
return binding.renderFileSync(options.file, newOptions.paths.join(':'), newOptions.style, newOptions.comments); return binding.renderFileSync(options.file, newOptions.paths.join(path.delimiter), newOptions.style, newOptions.comments);
} }
//Assume data is present if file is not. binding/libsass will tell the user otherwise! //Assume data is present if file is not. binding/libsass will tell the user otherwise!
return binding.renderSync(options.data, newOptions.paths.join(":"), newOptions.style); return binding.renderSync(options.data, newOptions.paths.join(path.delimiter), newOptions.style);
}; };
exports.middleware = require('./lib/middleware'); exports.middleware = require('./lib/middleware');
...@@ -94,6 +94,18 @@ describe("compile scss", function() { ...@@ -94,6 +94,18 @@ describe("compile scss", function() {
}); });
}); });
it("should have a error status of 1 for bad css", function(done) {
sass.render({
data: '{zzz}',
success: function(css) {
},
error: function(error, status) {
assert.equal(status, 1);
done();
}
});
});
it("should match compiled string with renderSync", function(done) { it("should match compiled string with renderSync", function(done) {
done(assert.equal(sass.renderSync({data: scssStr}), expectedRender)); done(assert.equal(sass.renderSync({data: scssStr}), expectedRender));
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment