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({ | 15 audit.define({ |
16 label: 'basic', | 16 label: 'basic', |
17 description: 'Simple unit tests for basic assertions.' | 17 description: 'Simple unit tests for basic assertions.' |
18 }, function (task, should) { | 18 }, function (task, should) { |
19 should(OfflineAudioContext, 'OfflineAudioContext').exist(); | 19 should(OfflineAudioContext, 'OfflineAudioContext').exist(); |
20 should(function () { var foo1 = 0; }, 'Setting foo1 to 0').notThrow(); | 20 should(function () { var foo1 = 0; }, 'Setting foo1 to 0').notThrow(); |
21 should(function () { var foo2 = bar; }).throw(); | 21 should(function () { var foo2 = bar; }).throw(); |
22 should(function () { var foo3 = bar; }).throw('ReferenceError'); | 22 should(function () { var foo3 = bar; }).throw('ReferenceError'); |
| 23 should(function () { var foo4 = bar; }).throw(null); |
| 24 should(function () { var foo5 = bar; }).throw(undefined); |
23 should(() => { should(); }, 'Calling should() with no argument') | 25 should(() => { should(); }, 'Calling should() with no argument') |
24 .throw('Error'); | 26 .throw('Error'); |
25 should(3 < 5, '3 < 5').beTrue(); | 27 should(3 < 5, '3 < 5').beTrue(); |
26 should(false).beFalse(); | 28 should(false).beFalse(); |
27 should(1).beEqualTo(1) | 29 should(1).beEqualTo(1) |
28 should(1).notBeEqualTo(2) | 30 should(1).notBeEqualTo(2) |
29 should(typeof AudioContext.prototype).beEqualTo('object'); | 31 should(typeof AudioContext.prototype).beEqualTo('object'); |
30 should(2).beGreaterThan(1); | 32 should(2).beGreaterThan(1); |
31 should(2).beGreaterThanOrEqualTo(2); | 33 should(2).beGreaterThanOrEqualTo(2); |
32 should(1).beLessThan(2); | 34 should(1).beLessThan(2); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 }); | 114 }); |
113 | 115 |
114 | 116 |
115 // You can enumerate tasks you want to execute in the order, or simply pass | 117 // You can enumerate tasks you want to execute in the order, or simply pass |
116 // no argument to run all the defined tasks. | 118 // no argument to run all the defined tasks. |
117 audit.run('numerical', 'numerical typed arrays', 'basic', | 119 audit.run('numerical', 'numerical typed arrays', 'basic', |
118 'load-file-in-should', 'dummy-label-string', 'dummy-label-object')
; | 120 'load-file-in-should', 'dummy-label-string', 'dummy-label-object')
; |
119 </script> | 121 </script> |
120 </body> | 122 </body> |
121 </html> | 123 </html> |
OLD | NEW |