Skip to content

Commit

Permalink
Implemented isBoolean and tests to match
Browse files Browse the repository at this point in the history
  • Loading branch information
joshkehn committed Jun 8, 2011
1 parent 3802967 commit 4144271
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
5 changes: 5 additions & 0 deletions lib/assert/macros.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ assert.isNumber = function (actual, message) {
assertTypeOf(actual, 'number', message || "expected {actual} to be a Number", assert.isNumber);
}
};
assert.isBoolean = function (actual, message) {
if (actual !== true && actual !== false) {
assert.fail(actual, 'NaN', message || "expected {actual} to be a Boolean", "===", assert.isBoolean);
}
};
assert.isNaN = function (actual, message) {
if (actual === actual) {
assert.fail(actual, 'NaN', message || "expected {actual} to be NaN", "===", assert.isNaN);
Expand Down
5 changes: 5 additions & 0 deletions test/assert-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ vows.describe('vows/assert').addBatch({
"`isNumber`": function (assert) {
assert.isNumber(0);
},
"`isBoolean`": function (assert){
assert.isBoolean(true);
assert.isBoolean(false);
assertError(assert.isBoolean, 0);
},
"`isNan`": function (assert) {
assert.isNaN(0/0);
},
Expand Down

0 comments on commit 4144271

Please sign in to comment.