Permalink
Browse files

Give more information when a test fails

  • Loading branch information...
1 parent c52a8b0 commit cb86962077402d1001ec7d9c8c3d627ee96874db @creationix committed Jan 12, 2010
Showing with 7 additions and 4 deletions.
  1. +7 −4 test/test.js
View
@@ -18,15 +18,18 @@ posix.readdir('.').addCallback(function (files) {
file.read(haml_file).addCallback(function (haml) {
file.read(base + ".html").addCallback(function (expected) {
try {
- scope.optimize = true;
- var actual = Haml.render(haml, scope);
+ var js = Haml.compile(haml);
+ var js_opt = Haml.optimize(js);
+ var actual = Haml.execute(js_opt, scope.context, scope.locals);
assert.equal(actual, expected);
} catch (e) {
var message = e.name;
if (e.message) message += ": " + e.message;
puts(message);
- puts("Actual:\n" + actual);
- puts("Expected:\n" + expected);
+ puts("\nJS:\n\n" + js);
+ puts("\nOptimized JS:\n\n" + js_opt);
+ puts("\nActual:\n\n" + actual);
+ puts("\nExpected:\n\n" + expected);
}
});
});

0 comments on commit cb86962

Please sign in to comment.