assert: throw when block is not a function
authorcjihrig <cjihrig@gmail.com>
Mon, 12 Jan 2015 16:13:18 +0000 (11:13 -0500)
committercjihrig <cjihrig@gmail.com>
Mon, 12 Jan 2015 19:10:33 +0000 (14:10 -0500)
commit14dc9175eb48789043d87bbd8e40d26727209bd0
tree0f6a48c424f1cc890810f2ceafa3fe5cf0aa012e
parent7c4a50dd2fc8ca7325292ef0cca99295a39cc6da
assert: throw when block is not a function

Currently, anything passed as the block argument to throws()
and doesNotThrow() is interpreted as a function, which can
lead to unexpected results. This commit checks the type of
block, and throws a TypeError if it is not a function.

Fixes: https://github.com/iojs/io.js/issues/275
PR-URL: https://github.com/iojs/io.js/pull/308
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
lib/assert.js
test/parallel/test-assert.js