Skip to content

Commit

Permalink
(new) assert.instanceOf assert.isUndefined
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhead committed May 23, 2010
1 parent 87afe4c commit 179f854
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/vows/macros.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ assert.isNull = function (actual, message) {
assert.fail(actual, 'null', message || "expected {actual} to be null", "===", assert.isNull);
}
};
assert.isUndefined = function (actual, message) {
if (actual !== undefined) {
assert.fail(actual, 'undefined', message || "expected {actual} to be undefined", "===", assert.isUndefined);
}
};
assert.isString = function (actual, message) {
assertTypeOf(actual, 'string', message || "expected {actual} to be a String", assert.isString);
};
Expand All @@ -88,6 +93,11 @@ assert.isFunction = function (actual, message) {
assert.typeOf = function (actual, expected, message) {
assertTypeOf(actual, expected, message, assert.typeOf);
};
assert.instanceOf = function (actual, expected, message) {
if (! (actual instanceof expected)) {
assert.fail(actual, expected, message || "expected {actual} to be an instance of {expected}", "instanceof", assert.instanceOf);
}
};

//
// Utility functions
Expand Down

0 comments on commit 179f854

Please sign in to comment.