From 5a8a050c4605b9382e21d40f46fca271874e77f1 Mon Sep 17 00:00:00 2001 From: Christian Williams Date: Thu, 12 Nov 2009 15:43:49 -0500 Subject: [PATCH] Removed toMatch and toNotMatch's message functions, now sufficiently handled by the default message builder. --- spec/suites/MatchersSpec.js | 11 +++-------- src/Matchers.js | 6 ------ 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/spec/suites/MatchersSpec.js b/spec/suites/MatchersSpec.js index 9bc40fe..ec00dea 100644 --- a/spec/suites/MatchersSpec.js +++ b/spec/suites/MatchersSpec.js @@ -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); }); diff --git a/src/Matchers.js b/src/Matchers.js index b31f4f6..49c165c 100644 --- a/src/Matchers.js +++ b/src/Matchers.js @@ -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(); } });