fix handling of no errors from error handling tests - closes #210

This commit is contained in:
Dane Springmeyer 2012-11-29 11:36:39 -08:00
parent a21a195f1b
commit 8ef4efbe39

View File

@ -19,13 +19,17 @@ helper.files('errorhandling', 'mml', function(file) {
local_data_dir: path.join(__dirname, 'rendering'), local_data_dir: path.join(__dirname, 'rendering'),
filename: file filename: file
}).render(mml, function (err) { }).render(mml, function (err) {
var result = helper.resultFile(file); if (!err) {
var output = err.message; console.warn("*** <--- WARNING invalid error handling test found (" + file + "): all error handling tests should throw errors!");
// @TODO for some reason, fs.readFile includes an additional \n } else {
// at the end of read files. Determine why. var result = helper.resultFile(file);
fs.readFile(helper.resultFile(file), 'utf8', function(err, data) { var output = err.message;
if (!err) assert.deepEqual(output, data.substr(0, data.length - 1)); // @TODO for some reason, fs.readFile includes an additional \n
}); // at the end of read files. Determine why.
fs.readFile(helper.resultFile(file), 'utf8', function(err, data) {
if (!err) assert.deepEqual(output, data.substr(0, data.length - 1));
});
}
}); });
} catch(err) { } catch(err) {
var result = helper.resultFile(file); var result = helper.resultFile(file);