Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleg Slobodskoi <oleg008@gmail.com>2010-12-21 20:42:52 +0300
committerRyan Dahl <ry@tinyclouds.org>2010-12-21 23:41:57 +0300
commit23cf938e4f7272635a50f8be9a5d99d40d60e0da (patch)
tree5c8b5f78d47e24396a91975cb0e717d2a547483e /lib/assert.js
parentd793fcaabd788a7b3c9af39a4c83360c1f6e3924 (diff)
fix assert.throws
Diffstat (limited to 'lib/assert.js')
-rw-r--r--lib/assert.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/assert.js b/lib/assert.js
index 3b18f05cb4b..b46f28b8625 100644
--- a/lib/assert.js
+++ b/lib/assert.js
@@ -246,13 +246,14 @@ function expectedException(actual, expected) {
}
if (expected instanceof RegExp) {
- if (expected.test(actual)) {
- return true;
- }
- } else if (actual instanceof expected ||
- expected.call({}, actual) !== false) {
+ return expected.test(actual);
+ } else if (actual instanceof expected) {
+ return true;
+ } else if ( expected.call({}, actual) === true ) {
return true;
}
+
+ return false;
}
function _throws(shouldThrow, block, expected, message) {