OLD | NEW |
1 /* global self */ | 1 /* global self */ |
2 | 2 |
3 // testharness.js has the higher priority. | 3 // testharness.js has the higher priority. |
4 var TESTHARNESS = true; | 4 var TESTHARNESS = true; |
5 var JSTEST = false; | 5 var JSTEST = false; |
6 | 6 |
7 (function () { | 7 (function () { |
8 // Selected properies from testharness.js | 8 // Selected properies from testharness.js |
9 var testharnessProperties = [ | 9 var testharnessProperties = [ |
10 'test', 'async_test', 'promise_test', 'promise_rejects', | 10 'test', 'async_test', 'promise_test', 'promise_rejects', |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 test(function () { | 590 test(function () { |
591 assert_true(false, failureMessage + failureDetail); | 591 assert_true(false, failureMessage + failureDetail); |
592 }, this.desc) | 592 }, this.desc) |
593 } else { | 593 } else { |
594 testFailed(failureMessage + failureDetail); | 594 testFailed(failureMessage + failureDetail); |
595 } | 595 } |
596 | 596 |
597 throw failureMessage; | 597 throw failureMessage; |
598 }; | 598 }; |
599 | 599 |
| 600 // Check if |target| does exist. (not undefined nor null) |
| 601 // |
| 602 // Example: |
| 603 // Should('null', null).exist(); |
| 604 // Result: |
| 605 // "FAIL null does not exist." |
| 606 ShouldModel.prototype.exist = function () { |
| 607 if (this.target !== null && this.target !== undefined) { |
| 608 this._testPassed('exist'); |
| 609 } else { |
| 610 this._testFailed('does not exist'); |
| 611 } |
| 612 }; |
| 613 |
600 // Check if |target| is equal to |value|. | 614 // Check if |target| is equal to |value|. |
601 // | 615 // |
602 // Example: | 616 // Example: |
603 // Should('Zero', 0).beEqualTo(0); | 617 // Should('Zero', 0).beEqualTo(0); |
604 // Result: | 618 // Result: |
605 // "PASS Zero is equal to 0." | 619 // "PASS Zero is equal to 0." |
606 ShouldModel.prototype.beEqualTo = function (value) { | 620 ShouldModel.prototype.beEqualTo = function (value) { |
607 if (value != null) { | 621 if (value != null) { |
608 var type = typeof value; | 622 var type = typeof value; |
609 this._assert(type === 'number' || type === 'string' || type === 'boo
lean', | 623 this._assert(type === 'number' || type === 'string' || type === 'boo
lean', |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 if (opts.hasOwnProperty('brief')) | 1191 if (opts.hasOwnProperty('brief')) |
1178 _opts.brief = opts.brief; | 1192 _opts.brief = opts.brief; |
1179 if (opts.hasOwnProperty('precision')) | 1193 if (opts.hasOwnProperty('precision')) |
1180 _opts.precision = opts.precision; | 1194 _opts.precision = opts.precision; |
1181 } | 1195 } |
1182 | 1196 |
1183 return new ShouldModel(desc, target, _opts); | 1197 return new ShouldModel(desc, target, _opts); |
1184 }; | 1198 }; |
1185 | 1199 |
1186 })(); | 1200 })(); |
OLD | NEW |