diff --git a/web/app/test/suite.js b/web/app/test/suite.js
index 5948f367..cf84de6b 100644
--- a/web/app/test/suite.js
+++ b/web/app/test/suite.js
@@ -4,15 +4,17 @@ TCAD.test.cases = {};
TCAD.test.runSuite = function() {
for (var p in TCAD.test.cases) {
_log("... Run test " + p);
- TCAD.test.cases[p].apply();
+ try {
+ TCAD.test.cases[p].apply();
+ } catch (e) {
+ _log("ERROR: " + e);
+ _log((e.stack+"").replace('\n', '
'));
+
+ }
}
_log("DONE.");
};
-function _log(text) {
- $('#testOutput').append("
"+text+"
");
-}
-
_loadFixture = function(name) {
APP.loadSketch(TCAD.test.fixtures[name]);
};
@@ -25,16 +27,27 @@ _loadFixturesToLocalStorage = function() {
}
};
+TCAD.test._ERROR_TITLE = "* Assertion Error.";
+
+
+function _log(text) {
+ $('#testOutput').append(""+text+"
");
+}
+
+function _logAssert(msg) {
+ _log(TCAD.test._ERROR_TITLE + " " + msg + "
" + new Error("").stack.split('\n')[3]);
+}
+
_assertEq = function(expected, actual, msg) {
if (expected !== actual) {
- _log("* Assertion Error. Expected [" + expected + "], but was [" + actual + "]");
+ _logAssert("Expected [" + expected + "], but was [" + actual + "]");
if (!!msg) _log(msg);
}
};
_assertEqD = function(expected, actual, precision, msg) {
if (Math.abs(expected - actual) > precision) {
- _log("* Assertion Error. Expected [" + expected + "] with precision " + precision + " but was [" + actual + "]");
+ _logAssert("Expected [" + expected + "] with precision " + precision + " but was [" + actual + "]");
if (!!msg) _log(msg);
}
};