Rebuild lib/jasmine.

This commit is contained in:
Christian Williams 2010-03-15 12:15:50 -07:00
parent 184ff6fb2d
commit 72ea614d5e
1 changed files with 22 additions and 19 deletions

View File

@ -794,6 +794,12 @@ jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) {
mismatchKeys = mismatchKeys || []; mismatchKeys = mismatchKeys || [];
mismatchValues = mismatchValues || []; mismatchValues = mismatchValues || [];
for (var i = 0; i < this.equalityTesters_.length; i++) {
var equalityTester = this.equalityTesters_[i];
var result = equalityTester(a, b, this, mismatchKeys, mismatchValues);
if (result !== jasmine.undefined) return result;
}
if (a === b) return true; if (a === b) return true;
if (a === jasmine.undefined || a === null || b === jasmine.undefined || b === null) { if (a === jasmine.undefined || a === null || b === jasmine.undefined || b === null) {
@ -820,12 +826,6 @@ jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) {
return this.compareObjects_(a, b, mismatchKeys, mismatchValues); return this.compareObjects_(a, b, mismatchKeys, mismatchValues);
} }
for (var i = 0; i < this.equalityTesters_.length; i++) {
var equalityTester = this.equalityTesters_[i];
var result = equalityTester(a, b, this, mismatchKeys, mismatchValues);
if (result !== jasmine.undefined) return result;
}
//Straight check //Straight check
return (a === b); return (a === b);
}; };
@ -1009,11 +1009,13 @@ jasmine.Matchers = function(env, actual, spec, opt_isNot) {
this.reportWasCalled_ = false; this.reportWasCalled_ = false;
}; };
// todo: @deprecated as of Jasmine 0.11, remove soon [xw]
jasmine.Matchers.pp = function(str) { jasmine.Matchers.pp = function(str) {
return jasmine.util.htmlEscape(jasmine.pp(str)); throw new Error("jasmine.Matchers.pp() is no longer supported, please use jasmine.pp() instead!");
this.report();
}; };
/** @deprecated */ /** @deprecated Deprecated as of Jasmine 0.10. Rewrite your custom matchers to return true or false. */
jasmine.Matchers.prototype.report = function(result, failing_message, details) { jasmine.Matchers.prototype.report = function(result, failing_message, details) {
// todo: report a deprecation warning [xw] // todo: report a deprecation warning [xw]
@ -1180,7 +1182,7 @@ jasmine.Matchers.prototype.wasCalled = function() {
} }
if (!jasmine.isSpy(this.actual)) { if (!jasmine.isSpy(this.actual)) {
throw new Error('Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.'); throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
} }
this.message = function() { this.message = function() {
@ -1199,7 +1201,7 @@ jasmine.Matchers.prototype.wasNotCalled = function() {
} }
if (!jasmine.isSpy(this.actual)) { if (!jasmine.isSpy(this.actual)) {
throw new Error('Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.'); throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
} }
this.message = function() { this.message = function() {
@ -1218,7 +1220,7 @@ jasmine.Matchers.prototype.wasNotCalled = function() {
jasmine.Matchers.prototype.wasCalledWith = function() { jasmine.Matchers.prototype.wasCalledWith = function() {
var expectedArgs = jasmine.util.argsToArray(arguments); var expectedArgs = jasmine.util.argsToArray(arguments);
if (!jasmine.isSpy(this.actual)) { if (!jasmine.isSpy(this.actual)) {
throw new Error('Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.'); throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
} }
this.message = function() { this.message = function() {
if (this.actual.callCount == 0) { if (this.actual.callCount == 0) {
@ -1234,7 +1236,7 @@ jasmine.Matchers.prototype.wasCalledWith = function() {
jasmine.Matchers.prototype.wasNotCalledWith = function() { jasmine.Matchers.prototype.wasNotCalledWith = function() {
var expectedArgs = jasmine.util.argsToArray(arguments); var expectedArgs = jasmine.util.argsToArray(arguments);
if (!jasmine.isSpy(this.actual)) { if (!jasmine.isSpy(this.actual)) {
throw new Error('Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.'); throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
} }
this.message = function() { this.message = function() {
@ -1882,8 +1884,7 @@ jasmine.Spec.prototype.finish = function(onComplete) {
} }
}; };
jasmine.Spec.prototype.after = function(doAfter, test) { jasmine.Spec.prototype.after = function(doAfter) {
if (this.queue.isRunning()) { if (this.queue.isRunning()) {
this.queue.add(new jasmine.Block(this.env, doAfter, this)); this.queue.add(new jasmine.Block(this.env, doAfter, this));
} else { } else {
@ -1911,23 +1912,25 @@ jasmine.Spec.prototype.execute = function(onComplete) {
jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() { jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() {
var runner = this.env.currentRunner(); var runner = this.env.currentRunner();
var i;
for (var suite = this.suite; suite; suite = suite.parentSuite) { for (var suite = this.suite; suite; suite = suite.parentSuite) {
for (var i = 0; i < suite.before_.length; i++) { for (i = 0; i < suite.before_.length; i++) {
this.queue.addBefore(new jasmine.Block(this.env, suite.before_[i], this)); this.queue.addBefore(new jasmine.Block(this.env, suite.before_[i], this));
} }
} }
for (var i = 0; i < runner.before_.length; i++) { for (i = 0; i < runner.before_.length; i++) {
this.queue.addBefore(new jasmine.Block(this.env, runner.before_[i], this)); this.queue.addBefore(new jasmine.Block(this.env, runner.before_[i], this));
} }
for (i = 0; i < this.afterCallbacks.length; i++) { for (i = 0; i < this.afterCallbacks.length; i++) {
this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this)); this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this));
} }
for (suite = this.suite; suite; suite = suite.parentSuite) { for (suite = this.suite; suite; suite = suite.parentSuite) {
for (var i = 0; i < suite.after_.length; i++) { for (i = 0; i < suite.after_.length; i++) {
this.queue.add(new jasmine.Block(this.env, suite.after_[i], this)); this.queue.add(new jasmine.Block(this.env, suite.after_[i], this));
} }
} }
for (var i = 0; i < runner.after_.length; i++) { for (i = 0; i < runner.after_.length; i++) {
this.queue.add(new jasmine.Block(this.env, runner.after_[i], this)); this.queue.add(new jasmine.Block(this.env, runner.after_[i], this));
} }
}; };
@ -2272,5 +2275,5 @@ jasmine.version_= {
"major": 0, "major": 0,
"minor": 10, "minor": 10,
"build": 1, "build": 1,
"revision": 1267503060 "revision": 1268680515
}; };