Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: chrome/third_party/mock4js/mock4js.js

Issue 330423005: Fix failure handling in mock4js to throw instead of calling an undefined function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Rebase on top of CRLF -> LF conversion Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/third_party/mock4js/README.chromium ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /** 1 /**
2 * Mock4JS 0.2 2 * Mock4JS 0.2
3 * http://mock4js.sourceforge.net/ 3 * http://mock4js.sourceforge.net/
4 */ 4 */
5 5
6 Mock4JS = { 6 Mock4JS = {
7 _mocksToVerify: [], 7 _mocksToVerify: [],
8 _convertToConstraint: function(constraintOrValue) { 8 _convertToConstraint: function(constraintOrValue) {
9 if(constraintOrValue.argumentMatches) { 9 if(constraintOrValue.argumentMatches) {
10 return constraintOrValue; // it's already an ArgumentMat cher 10 return constraintOrValue; // it's already an ArgumentMat cher
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 toString: function() { 115 toString: function() {
116 return this.message; 116 return this.message;
117 } 117 }
118 } 118 }
119 119
120 /** 120 /**
121 * Assert function that makes use of the constraint methods 121 * Assert function that makes use of the constraint methods
122 */ 122 */
123 assertThat = function(expected, argumentMatcher) { 123 assertThat = function(expected, argumentMatcher) {
124 if(!argumentMatcher.argumentMatches(expected)) { 124 if(!argumentMatcher.argumentMatches(expected)) {
125 » » fail("Expected '"+expected+"' to be "+argumentMatcher.describe() ); 125 » » throw new Mock4JSException("Expected '"+expected+"' to be "+argu mentMatcher.describe());
126 } 126 }
127 } 127 }
128 128
129 /** 129 /**
130 * CallCounter 130 * CallCounter
131 */ 131 */
132 function CallCounter(expectedCount) { 132 function CallCounter(expectedCount) {
133 this._expectedCallCount = expectedCount; 133 this._expectedCallCount = expectedCount;
134 this._actualCallCount = 0; 134 this._actualCallCount = 0;
135 } 135 }
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 }, 615 },
616 616
617 _describeMockSetup: function() { 617 _describeMockSetup: function() {
618 var msg = "\nAllowed:"; 618 var msg = "\nAllowed:";
619 for(var i=0; i<this._expectedInvocations.length; i++) { 619 for(var i=0; i<this._expectedInvocations.length; i++) {
620 var expectedInvocation = this._expectedInvocations[i]; 620 var expectedInvocation = this._expectedInvocations[i];
621 msg += "\n" + expectedInvocation.describe(); 621 msg += "\n" + expectedInvocation.describe();
622 } 622 }
623 return msg; 623 return msg;
624 } 624 }
625 } 625 }
OLDNEW
« no previous file with comments | « chrome/third_party/mock4js/README.chromium ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698