diff --git a/lib/jasmine-0.10.1.js b/lib/jasmine-0.10.1.js index 6cf0b57..f1d7ff9 100644 --- a/lib/jasmine-0.10.1.js +++ b/lib/jasmine-0.10.1.js @@ -92,6 +92,16 @@ jasmine.isArray_ = function(value) { return Object.prototype.toString.apply(value) === '[object Array]'; }; +/** + * @ignore + * @private + * @param value + * @returns {Boolean} + */ +jasmine.isString_ = function(value) { + return Object.prototype.toString.apply(value) === '[object String]'; +}; + /** * Pretty printer for expecations. Takes any object and turns it into a human-readable string. * @@ -822,6 +832,10 @@ jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) { return b.matches(a); } + if (jasmine.isString_(a) && jasmine.isString_(b)) { + return (a == b); + } + if (typeof a === "object" && typeof b === "object") { return this.compareObjects_(a, b, mismatchKeys, mismatchValues); } @@ -2275,5 +2289,5 @@ jasmine.version_= { "major": 0, "minor": 10, "build": 1, - "revision": 1268680515 + "revision": 1268838574 }; diff --git a/spec/suites/MatchersSpec.js b/spec/suites/MatchersSpec.js index 6d54bb1..faae5e4 100644 --- a/spec/suites/MatchersSpec.js +++ b/spec/suites/MatchersSpec.js @@ -54,6 +54,9 @@ describe("jasmine.Matchers", function() { expect((match(['a', 'b']).toEqual(['a', jasmine.undefined]))).toEqual(false); expect((match(['a', 'b']).toEqual(['a', 'b', jasmine.undefined]))).toEqual(false); + + expect((match(new String("cat")).toEqual("cat"))).toBe(true); + expect((match(new String("cat")).toNotEqual("cat"))).toBe(false); }); it("toEqual to build an Expectation Result", function() { diff --git a/src/Env.js b/src/Env.js index 8a50035..38262e5 100644 --- a/src/Env.js +++ b/src/Env.js @@ -209,6 +209,10 @@ jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) { return b.matches(a); } + if (jasmine.isString_(a) && jasmine.isString_(b)) { + return (a == b); + } + if (typeof a === "object" && typeof b === "object") { return this.compareObjects_(a, b, mismatchKeys, mismatchValues); } diff --git a/src/base.js b/src/base.js index fc4837b..751fc15 100755 --- a/src/base.js +++ b/src/base.js @@ -92,6 +92,16 @@ jasmine.isArray_ = function(value) { return Object.prototype.toString.apply(value) === '[object Array]'; }; +/** + * @ignore + * @private + * @param value + * @returns {Boolean} + */ +jasmine.isString_ = function(value) { + return Object.prototype.toString.apply(value) === '[object String]'; +}; + /** * Pretty printer for expecations. Takes any object and turns it into a human-readable string. *