Removed toMatch and toNotMatch's message functions, now sufficiently handled by the default message builder.

This commit is contained in:
Christian Williams 2009-11-12 15:43:49 -05:00
parent 7be8247b2f
commit 5a8a050c46
2 changed files with 3 additions and 14 deletions

View File

@ -161,8 +161,7 @@ describe("jasmine.Matchers", function() {
expect(result.matcherName).toEqual("toMatch");
expect(result.passed()).toEqual(false);
expect(result.message).toMatch(jasmine.pp(actual));
expect(result.message).toMatch(new RegExp(expected).toString());
expect(result.message).toEqual("Expected 'a' to match 'b'.");
expect(result.expected).toEqual(expected);
expect(result.actual).toEqual(actual);
});
@ -177,9 +176,7 @@ describe("jasmine.Matchers", function() {
expect(result.matcherName).toEqual("toNotMatch");
expect(result.passed()).toEqual(false);
expect(result.message).toMatch(expected.toString());
expect(result.message).toMatch(jasmine.pp(actual));
expect(result.message).toMatch("not");
expect(result.message).toEqual("Expected 'a' to not match /a/.");
expect(result.expected).toEqual(expected);
expect(result.actual).toEqual(actual);
});
@ -193,9 +190,7 @@ describe("jasmine.Matchers", function() {
expect(result.matcherName).toEqual("toNotMatch");
expect(result.passed()).toEqual(false);
expect(result.message).toMatch(jasmine.pp(str));
expect(result.message).toMatch(new RegExp(str).toString());
expect(result.message).toMatch("not");
expect(result.message).toEqual("Expected 'a' to not match 'a'.");
expect(result.expected).toEqual(str);
expect(result.actual).toEqual(str);
});

View File

@ -112,9 +112,6 @@ jasmine.Matchers.prototype.toNotEqual = jasmine.Matchers.matcherFn_('toNotEqual'
jasmine.Matchers.prototype.toMatch = jasmine.Matchers.matcherFn_('toMatch', {
test: function(expected) {
return new RegExp(expected).test(this.actual);
},
message: function(expected) {
return jasmine.pp(this.actual) + " does not match the regular expression " + new RegExp(expected).toString();
}
});
@ -125,9 +122,6 @@ jasmine.Matchers.prototype.toMatch = jasmine.Matchers.matcherFn_('toMatch', {
jasmine.Matchers.prototype.toNotMatch = jasmine.Matchers.matcherFn_('toNotMatch', {
test: function(expected) {
return !(new RegExp(expected).test(this.actual));
},
message: function(expected) {
return jasmine.pp(this.actual) + " should not match " + new RegExp(expected).toString();
}
});