diff options
Diffstat (limited to 'src/utility.js')
-rw-r--r-- | src/utility.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/utility.js b/src/utility.js index ec4bf99b..ce726fbe 100644 --- a/src/utility.js +++ b/src/utility.js @@ -46,13 +46,18 @@ function dumpKeys(item) { function assertEq(a, b) { if (a !== b) { - print("Stack: " + new Error().stack); - throw "Should have been equal: " + a + " : " + b; + print('Stack: ' + new Error().stack); + throw 'Should have been equal: ' + a + ' : ' + b; } } -function assertTrue(a) { - assertEq(!!a, true); +function assertTrue(a, msg) { + if (!a) { + msg = 'Assertion failed: ' + msg; + print(msg); + print('Stack: ' + new Error().stack); + throw msg; + } } assert = assertTrue; |