Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function compile(src, language){
var text = fs.readFileSync(src, "utf8");
var errors = "";
var result = oc.compile(text, language, function(e){errors += e;}, extractOptions(text));
if (errors)
throw new Test.TestError(errors);
return result;
}
function expectError(src, dirs, language){
var text = fs.readFileSync(src, "utf8");
var errors = "";
try {
oc.compile(text, language, function(e){errors += e + "\n";});
}
catch (e){
errors += e;
}
if (!errors.length)
throw new Test.TestError("compiler error expected");
var resultName = path.basename(src).replace(".ob", ".txt");
compareResults(errors, resultName, dirs);
}