mirror of
https://github.com/chaijs/chai
synced 2024-11-15 00:07:11 +00:00
error message language matches should
This commit is contained in:
parent
c4a89f3b91
commit
b2eb61848b
1 changed files with 19 additions and 15 deletions
|
@ -51,7 +51,11 @@ Assertion.prototype.__defineGetter__('have', function () {
|
|||
});
|
||||
|
||||
Assertion.prototype.__defineGetter__('include', function () {
|
||||
this.include = true;
|
||||
this.includes = true;
|
||||
return this;
|
||||
});
|
||||
|
||||
Assertion.prototype.__defineGetter__('with', function () {
|
||||
return this;
|
||||
});
|
||||
|
||||
|
@ -72,8 +76,8 @@ Assertion.prototype.__defineGetter__('ok', function () {
|
|||
Assertion.prototype.__defineGetter__('true', function () {
|
||||
this.assert(
|
||||
true === this.obj
|
||||
, 'expected ' + this.inspect + ' to be truthy'
|
||||
, 'expected ' + this.inspect + ' to be falsey');
|
||||
, 'expected ' + this.inspect + ' to be true'
|
||||
, 'expected ' + this.inspect + ' to be false');
|
||||
|
||||
return this;
|
||||
});
|
||||
|
@ -81,8 +85,8 @@ Assertion.prototype.__defineGetter__('true', function () {
|
|||
Assertion.prototype.__defineGetter__('false', function () {
|
||||
this.assert(
|
||||
false === this.obj
|
||||
, 'expected ' + this.inspect + ' to be truthy'
|
||||
, 'expected ' + this.inspect + ' to be falsey');
|
||||
, 'expected ' + this.inspect + ' to be false'
|
||||
, 'expected ' + this.inspect + ' to be true');
|
||||
|
||||
return this;
|
||||
});
|
||||
|
@ -101,8 +105,8 @@ Assertion.prototype.__defineGetter__('empty', function () {
|
|||
|
||||
this.assert(
|
||||
0 === this.obj.length
|
||||
, 'expected ' + this.inspect + ' to exist'
|
||||
, 'expected ' + this.inspect + ' to not exist');
|
||||
, 'expected ' + this.inspect + ' to be empty'
|
||||
, 'expected ' + this.inspect + ' not to be empty');
|
||||
|
||||
return this;
|
||||
});
|
||||
|
@ -119,8 +123,8 @@ Assertion.prototype.equal = function (val) {
|
|||
Assertion.prototype.eql = function (obj) {
|
||||
this.assert(
|
||||
eql(obj, this.obj)
|
||||
, 'expected ' + this.inspect + ' to be deeply equal ' + inspect(obj)
|
||||
, 'expected ' + this.inspect + ' to be below' + inspect(obj));
|
||||
, 'expected ' + this.inspect + ' to equal ' + inspect(obj)
|
||||
, 'expected ' + this.inspect + ' to not equal ' + inspect(obj));
|
||||
return this;
|
||||
};
|
||||
|
||||
|
@ -128,7 +132,7 @@ Assertion.prototype.above = function (val) {
|
|||
this.assert(
|
||||
this.obj > val
|
||||
, 'expected ' + this.inspect + ' to be above ' + val
|
||||
, 'expected ' + this.inspect + ' to be below' + val);
|
||||
, 'expected ' + this.inspect + ' to be below ' + val);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
@ -146,7 +150,7 @@ Assertion.prototype.a = function (type) {
|
|||
this.assert(
|
||||
type == typeof this.obj
|
||||
, 'expected ' + this.inspect + ' to be a ' + type
|
||||
, 'expected ' + this.inspect + ' to not be a ' + type);
|
||||
, 'expected ' + this.inspect + ' not to be a ' + type);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
@ -193,7 +197,7 @@ Assertion.prototype.length = function (n) {
|
|||
|
||||
this.assert(
|
||||
len == n
|
||||
, 'expected ' + this.inspect + ' to be an length of ' + n + ' bug got ' + len
|
||||
, 'expected ' + this.inspect + ' to have a length of ' + n + ' but got ' + len
|
||||
, 'expected ' + this.inspect + ' to not have a length of ' + len);
|
||||
|
||||
return this;
|
||||
|
@ -203,7 +207,7 @@ Assertion.prototype.match = function (re) {
|
|||
this.assert(
|
||||
re.exec(this.obj)
|
||||
, 'expected ' + this.inspect + ' to match ' + re
|
||||
, 'expected ' + this.inspect + ' to not match ' + re);
|
||||
, 'expected ' + this.inspect + ' not to match ' + re);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
@ -224,8 +228,8 @@ Assertion.prototype.string = function (str) {
|
|||
|
||||
this.assert(
|
||||
~this.obj.indexOf(str)
|
||||
, 'expected ' + this.inspect + ' to include ' + str
|
||||
, 'expected ' + this.inspect + ' to not include ' + str);
|
||||
, 'expected ' + this.inspect + ' to include ' + inspect(str)
|
||||
, 'expected ' + this.inspect + ' to not include ' + inspect(str));
|
||||
|
||||
return this;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue