Permalink
Browse files

Implemented isBoolean and tests to match

  • Loading branch information...
1 parent 3802967 commit 41442710d1267868eb60809c5cd4a49f3f63275e @joshkehn joshkehn committed Jun 8, 2011
Showing with 11 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +5 −0 lib/assert/macros.js
  3. +5 −0 test/assert-test.js
View
@@ -0,0 +1 @@
+node_modules
View
@@ -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);
View
@@ -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);
},

0 comments on commit 4144271

Please sign in to comment.