OLD | NEW |
1 if (window.testRunner) | 1 if (window.testRunner) |
2 testRunner.overridePreference("WebKitWebAudioEnabled", "1"); | 2 testRunner.overridePreference("WebKitWebAudioEnabled", "1"); |
3 | 3 |
4 function writeString(s, a, offset) { | 4 function writeString(s, a, offset) { |
5 for (var i = 0; i < s.length; ++i) { | 5 for (var i = 0; i < s.length; ++i) { |
6 a[offset + i] = s.charCodeAt(i); | 6 a[offset + i] = s.charCodeAt(i); |
7 } | 7 } |
8 } | 8 } |
9 | 9 |
10 function writeInt16(n, a, offset) { | 10 function writeInt16(n, a, offset) { |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 } | 590 } |
591 | 591 |
592 try { | 592 try { |
593 this.target(); | 593 this.target(); |
594 this._testFailed('did not throw an exception'); | 594 this._testFailed('did not throw an exception'); |
595 } catch (error) { | 595 } catch (error) { |
596 if (errorType === undefined) | 596 if (errorType === undefined) |
597 this._testPassed('threw an exception of type ' + error.name); | 597 this._testPassed('threw an exception of type ' + error.name); |
598 else if (error.name === errorType) | 598 else if (error.name === errorType) |
599 this._testPassed('threw ' + errorType + ': ' + error.message); | 599 this._testPassed('threw ' + errorType + ': ' + error.message); |
| 600 else if (self.hasOwnProperty(errorType) && error instanceof self[err
orType]) |
| 601 this._testPassed('threw ' + errorType + ': ' + error.message); |
600 else | 602 else |
601 this._testFailed('threw ' + error.name + ' instead of ' + except
ion); | 603 this._testFailed('threw ' + error.name + ' instead of ' + except
ion); |
602 } | 604 } |
603 return this._success; | 605 return this._success; |
604 }; | 606 }; |
605 | 607 |
606 // Check if |func| does not throw an exception. | 608 // Check if |func| does not throw an exception. |
607 // | 609 // |
608 // Example: | 610 // Example: |
609 // Should('var foo = "bar"', function () { var foo = 'bar'; }).notThrow(); | 611 // Should('var foo = "bar"', function () { var foo = 'bar'; }).notThrow(); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 if (opts.hasOwnProperty('numberOfErrorLog')) | 833 if (opts.hasOwnProperty('numberOfErrorLog')) |
832 _opts.numberOfErrorLog = opts.numberOfErrorLog; | 834 _opts.numberOfErrorLog = opts.numberOfErrorLog; |
833 if (opts.hasOwnProperty('numberOfArrayLog')) | 835 if (opts.hasOwnProperty('numberOfArrayLog')) |
834 _opts.numberOfArrayLog = opts.numberOfArrayLog; | 836 _opts.numberOfArrayLog = opts.numberOfArrayLog; |
835 } | 837 } |
836 | 838 |
837 return new ShouldModel(desc, target, _opts); | 839 return new ShouldModel(desc, target, _opts); |
838 }; | 840 }; |
839 | 841 |
840 })(); | 842 })(); |
OLD | NEW |