mirror of
https://github.com/chaijs/chai
synced 2024-11-15 08:17:14 +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 () {
|
Assertion.prototype.__defineGetter__('include', function () {
|
||||||
this.include = true;
|
this.includes = true;
|
||||||
|
return this;
|
||||||
|
});
|
||||||
|
|
||||||
|
Assertion.prototype.__defineGetter__('with', function () {
|
||||||
return this;
|
return this;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -72,8 +76,8 @@ Assertion.prototype.__defineGetter__('ok', function () {
|
||||||
Assertion.prototype.__defineGetter__('true', function () {
|
Assertion.prototype.__defineGetter__('true', function () {
|
||||||
this.assert(
|
this.assert(
|
||||||
true === this.obj
|
true === this.obj
|
||||||
, 'expected ' + this.inspect + ' to be truthy'
|
, 'expected ' + this.inspect + ' to be true'
|
||||||
, 'expected ' + this.inspect + ' to be falsey');
|
, 'expected ' + this.inspect + ' to be false');
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
});
|
});
|
||||||
|
@ -81,8 +85,8 @@ Assertion.prototype.__defineGetter__('true', function () {
|
||||||
Assertion.prototype.__defineGetter__('false', function () {
|
Assertion.prototype.__defineGetter__('false', function () {
|
||||||
this.assert(
|
this.assert(
|
||||||
false === this.obj
|
false === this.obj
|
||||||
, 'expected ' + this.inspect + ' to be truthy'
|
, 'expected ' + this.inspect + ' to be false'
|
||||||
, 'expected ' + this.inspect + ' to be falsey');
|
, 'expected ' + this.inspect + ' to be true');
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
});
|
});
|
||||||
|
@ -101,8 +105,8 @@ Assertion.prototype.__defineGetter__('empty', function () {
|
||||||
|
|
||||||
this.assert(
|
this.assert(
|
||||||
0 === this.obj.length
|
0 === this.obj.length
|
||||||
, 'expected ' + this.inspect + ' to exist'
|
, 'expected ' + this.inspect + ' to be empty'
|
||||||
, 'expected ' + this.inspect + ' to not exist');
|
, 'expected ' + this.inspect + ' not to be empty');
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
});
|
});
|
||||||
|
@ -119,8 +123,8 @@ Assertion.prototype.equal = function (val) {
|
||||||
Assertion.prototype.eql = function (obj) {
|
Assertion.prototype.eql = function (obj) {
|
||||||
this.assert(
|
this.assert(
|
||||||
eql(obj, this.obj)
|
eql(obj, this.obj)
|
||||||
, 'expected ' + this.inspect + ' to be deeply equal ' + inspect(obj)
|
, 'expected ' + this.inspect + ' to equal ' + inspect(obj)
|
||||||
, 'expected ' + this.inspect + ' to be below' + inspect(obj));
|
, 'expected ' + this.inspect + ' to not equal ' + inspect(obj));
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -128,7 +132,7 @@ Assertion.prototype.above = function (val) {
|
||||||
this.assert(
|
this.assert(
|
||||||
this.obj > val
|
this.obj > val
|
||||||
, 'expected ' + this.inspect + ' to be above ' + val
|
, 'expected ' + this.inspect + ' to be above ' + val
|
||||||
, 'expected ' + this.inspect + ' to be below' + val);
|
, 'expected ' + this.inspect + ' to be below ' + val);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
@ -146,7 +150,7 @@ Assertion.prototype.a = function (type) {
|
||||||
this.assert(
|
this.assert(
|
||||||
type == typeof this.obj
|
type == typeof this.obj
|
||||||
, 'expected ' + this.inspect + ' to be a ' + type
|
, '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;
|
return this;
|
||||||
};
|
};
|
||||||
|
@ -193,7 +197,7 @@ Assertion.prototype.length = function (n) {
|
||||||
|
|
||||||
this.assert(
|
this.assert(
|
||||||
len == n
|
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);
|
, 'expected ' + this.inspect + ' to not have a length of ' + len);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
@ -203,7 +207,7 @@ Assertion.prototype.match = function (re) {
|
||||||
this.assert(
|
this.assert(
|
||||||
re.exec(this.obj)
|
re.exec(this.obj)
|
||||||
, 'expected ' + this.inspect + ' to match ' + re
|
, 'expected ' + this.inspect + ' to match ' + re
|
||||||
, 'expected ' + this.inspect + ' to not match ' + re);
|
, 'expected ' + this.inspect + ' not to match ' + re);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
@ -224,8 +228,8 @@ Assertion.prototype.string = function (str) {
|
||||||
|
|
||||||
this.assert(
|
this.assert(
|
||||||
~this.obj.indexOf(str)
|
~this.obj.indexOf(str)
|
||||||
, 'expected ' + this.inspect + ' to include ' + str
|
, 'expected ' + this.inspect + ' to include ' + inspect(str)
|
||||||
, 'expected ' + this.inspect + ' to not include ' + str);
|
, 'expected ' + this.inspect + ' to not include ' + inspect(str));
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue