| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>audit.js: basic tests</title> | 4 <title>audit.js: basic tests</title> |
| 5 <script src="../../resources/testharness.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> | 6 <script src="../../resources/testharnessreport.js"></script> |
| 7 <script src="../resources/audit.js"></script> | 7 <script src="../resources/audit.js"></script> |
| 8 </head> | 8 </head> |
| 9 <body> | 9 <body> |
| 10 <script> | 10 <script> |
| 11 var audit = Audit.createTaskRunner({ requireResultFile: true }); | 11 var audit = Audit.createTaskRunner({ requireResultFile: true }); |
| 12 | 12 |
| 13 | 13 |
| 14 // Basic assertion testing. | 14 // Basic assertion testing. |
| 15 audit.define('basic', function (task, should) { | 15 audit.define('basic', function (task, should) { |
| 16 task.describe('Simple unit tests for basic assertions.'); | 16 task.describe('Simple unit tests for basic assertions.'); |
| 17 | 17 |
| 18 should(OfflineAudioContext, 'OfflineAudioContext').exist(); | 18 should(OfflineAudioContext, 'OfflineAudioContext').exist(); |
| 19 should(function () { var foo1 = 0; }, 'Setting foo1 to 0').notThrow(); | 19 should(function () { var foo1 = 0; }, 'Setting foo1 to 0').notThrow(); |
| 20 should(function () { var foo2 = bar; }).throw(); | 20 should(function () { var foo2 = bar; }).throw(); |
| 21 should(function () { var foo3 = bar; }).throw('ReferenceError'); | 21 should(function () { var foo3 = bar; }).throw('ReferenceError'); |
| 22 should(() => { should(); }, 'Calling should() with no argument') |
| 23 .throw('Error'); |
| 22 should(3 < 5, '3 < 5').beTrue(); | 24 should(3 < 5, '3 < 5').beTrue(); |
| 23 should(false).beFalse(); | 25 should(false).beFalse(); |
| 24 should(1).beEqualTo(1) | 26 should(1).beEqualTo(1) |
| 25 should(1).notBeEqualTo(2) | 27 should(1).notBeEqualTo(2) |
| 26 should(typeof AudioContext.prototype).beEqualTo('object'); | 28 should(typeof AudioContext.prototype).beEqualTo('object'); |
| 27 should(2).beGreaterThan(1); | 29 should(2).beGreaterThan(1); |
| 28 should(2).beGreaterThanOrEqualTo(2); | 30 should(2).beGreaterThanOrEqualTo(2); |
| 29 should(1).beLessThan(2); | 31 should(1).beLessThan(2); |
| 30 should(1).beLessThanOrEqualTo(1); | 32 should(1).beLessThanOrEqualTo(1); |
| 31 should(should(1).beEqualTo(1), 'should(1).beEqualTo(1)').beTrue(); | 33 should(should(1).beEqualTo(1), 'should(1).beEqualTo(1)').beTrue(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 task.done(); | 72 task.done(); |
| 71 }); | 73 }); |
| 72 | 74 |
| 73 | 75 |
| 74 // You can enumerate tasks you want to execute in the order, or simply pass | 76 // You can enumerate tasks you want to execute in the order, or simply pass |
| 75 // no argument to run all the defined tasks. | 77 // no argument to run all the defined tasks. |
| 76 audit.run('numerical', 'basic'); | 78 audit.run('numerical', 'basic'); |
| 77 </script> | 79 </script> |
| 78 </body> | 80 </body> |
| 79 </html> | 81 </html> |
| OLD | NEW |