@@ -14,27 +14,19 @@ describe("AudioBuffer", function() {
14
14
15
15
assert . throws ( function ( ) {
16
16
audioContext . createBuffer ( 1.5 , 128 , 44100 ) ;
17
- } , function ( e ) {
18
- return e instanceof TypeError && / s h o u l d b e a p o s i t i v e i n t e g e r / . test ( e . message ) ;
19
- } ) ;
17
+ } , TypeError ) ;
20
18
21
19
assert . throws ( function ( ) {
22
20
audioContext . createBuffer ( 2 , 16.5 , 44100 ) ;
23
- } , function ( e ) {
24
- return e instanceof TypeError && / s h o u l d b e a p o s i t i v e i n t e g e r / . test ( e . message ) ;
25
- } ) ;
21
+ } , TypeError ) ;
26
22
27
23
assert . throws ( function ( ) {
28
24
audioContext . createBuffer ( 2 , 128 , 44100.5 ) ;
29
- } , function ( e ) {
30
- return e instanceof TypeError && / s h o u l d b e a p o s i t i v e i n t e g e r / . test ( e . message ) ;
31
- } ) ;
25
+ } , TypeError ) ;
32
26
33
27
assert . throws ( function ( ) {
34
28
return new global . AudioBuffer ( ) ;
35
- } , function ( e ) {
36
- return e instanceof TypeError && / I l l e g a l c o n s t r u c t o r / . test ( e . message ) ;
37
- } ) ;
29
+ } , TypeError ) ;
38
30
} ) ;
39
31
} ) ;
40
32
@@ -50,9 +42,7 @@ describe("AudioBuffer", function() {
50
42
51
43
assert . throws ( function ( ) {
52
44
buf1 . sampleRate = 48000 ;
53
- } , function ( e ) {
54
- return e instanceof TypeError && / r e a d o n l y / . test ( e . message ) ;
55
- } ) ;
45
+ } , TypeError ) ;
56
46
} ) ;
57
47
} ) ;
58
48
@@ -68,9 +58,7 @@ describe("AudioBuffer", function() {
68
58
69
59
assert . throws ( function ( ) {
70
60
buf1 . length = 32 ;
71
- } , function ( e ) {
72
- return e instanceof TypeError && / r e a d o n l y / . test ( e . message ) ;
73
- } ) ;
61
+ } , TypeError ) ;
74
62
} ) ;
75
63
} ) ;
76
64
@@ -86,9 +74,7 @@ describe("AudioBuffer", function() {
86
74
87
75
assert . throws ( function ( ) {
88
76
buf1 . duration = 32 / 48000 ;
89
- } , function ( e ) {
90
- return e instanceof TypeError && / r e a d o n l y / . test ( e . message ) ;
91
- } ) ;
77
+ } , TypeError ) ;
92
78
} ) ;
93
79
} ) ;
94
80
@@ -104,9 +90,7 @@ describe("AudioBuffer", function() {
104
90
105
91
assert . throws ( function ( ) {
106
92
buf1 . numberOfChannels = 2 ;
107
- } , function ( e ) {
108
- return e instanceof TypeError && / r e a d o n l y / . test ( e . message ) ;
109
- } ) ;
93
+ } , TypeError ) ;
110
94
} ) ;
111
95
} ) ;
112
96
@@ -129,19 +113,13 @@ describe("AudioBuffer", function() {
129
113
130
114
assert . throws ( function ( ) {
131
115
buf1 . getChannelData ( 1 ) ;
132
- } , function ( e ) {
133
- return e instanceof TypeError && / e x c e e d s n u m b e r o f c h a n n e l s / . test ( e . message ) ;
134
- } ) ;
116
+ } , TypeError ) ;
135
117
assert . throws ( function ( ) {
136
118
buf2 . getChannelData ( 2 ) ;
137
- } , function ( e ) {
138
- return e instanceof TypeError && / e x c e e d s n u m b e r o f c h a n n e l s / . test ( e . message ) ;
139
- } ) ;
119
+ } , TypeError ) ;
140
120
assert . throws ( function ( ) {
141
121
buf1 . getChannelData ( 2.5 ) ;
142
- } , function ( e ) {
143
- return e instanceof TypeError && / s h o u l d b e a p o s i t i v e i n t e g e r / . test ( e . message ) ;
144
- } ) ;
122
+ } , TypeError ) ;
145
123
146
124
assert ( buf1 . getChannelData === global . AudioBuffer . prototype . getChannelData ) ;
147
125
} ) ;
@@ -157,9 +135,7 @@ describe("AudioBuffer", function() {
157
135
158
136
assert . throws ( function ( ) {
159
137
buf1 . copyFromChannel ( dest , 0 , 0 ) ;
160
- } , function ( e ) {
161
- return e instanceof TypeError && / n o t e n a b l e d / . test ( e . message ) ;
162
- } ) ;
138
+ } , TypeError ) ;
163
139
164
140
WebAudioTestAPI . setState ( "AudioBuffer#copyFromChannel" , "enabled" ) ;
165
141
@@ -177,39 +153,27 @@ describe("AudioBuffer", function() {
177
153
178
154
assert . throws ( function ( ) {
179
155
buf1 . copyFromChannel ( "INVALID" , 0 , 0 ) ;
180
- } , function ( e ) {
181
- return e instanceof TypeError && / s h o u l d b e a F l o a t 3 2 A r r a y / . test ( e . message ) ;
182
- } ) ;
156
+ } , TypeError ) ;
183
157
184
158
assert . throws ( function ( ) {
185
159
buf1 . copyFromChannel ( dest , "INVALID" , 0 ) ;
186
- } , function ( e ) {
187
- return e instanceof TypeError && / s h o u l d b e a p o s i t i v e i n t e g e r / . test ( e . message ) ;
188
- } ) ;
160
+ } , TypeError ) ;
189
161
190
162
assert . throws ( function ( ) {
191
163
buf1 . copyFromChannel ( dest , 0 , "INVALID" ) ;
192
- } , function ( e ) {
193
- return e instanceof TypeError && / s h o u l d b e a p o s i t i v e i n t e g e r / . test ( e . message ) ;
194
- } ) ;
164
+ } , TypeError ) ;
195
165
196
166
assert . throws ( function ( ) {
197
167
buf1 . copyFromChannel ( dest , 10 , 0 ) ;
198
- } , function ( e ) {
199
- return e instanceof TypeError && / o u t s i d e t h e r a n g e / . test ( e . message ) ;
200
- } ) ;
168
+ } , TypeError ) ;
201
169
202
170
assert . throws ( function ( ) {
203
171
buf1 . copyFromChannel ( dest , 0 , 10 ) ;
204
- } , function ( e ) {
205
- return e instanceof TypeError && / o u t s i d e t h e r a n g e / . test ( e . message ) ;
206
- } ) ;
172
+ } , TypeError ) ;
207
173
208
174
assert . throws ( function ( ) {
209
175
buf1 . copyFromChannel ( dest , 0 , undefined ) ;
210
- } , function ( e ) {
211
- return e instanceof TypeError && / s h o u l d b e a p o s i t i v e i n t e g e r / . test ( e . message ) ;
212
- } ) ;
176
+ } , TypeError ) ;
213
177
214
178
WebAudioTestAPI . setState ( "AudioBuffer#copyFromChannel" , "disabled" ) ;
215
179
@@ -224,9 +188,7 @@ describe("AudioBuffer", function() {
224
188
225
189
assert . throws ( function ( ) {
226
190
buf1 . copyToChannel ( source , 0 , 0 ) ;
227
- } , function ( e ) {
228
- return e instanceof TypeError && / n o t e n a b l e d / . test ( e . message ) ;
229
- } ) ;
191
+ } , TypeError ) ;
230
192
231
193
WebAudioTestAPI . setState ( "AudioBuffer#copyToChannel" , "enabled" ) ;
232
194
@@ -244,39 +206,27 @@ describe("AudioBuffer", function() {
244
206
245
207
assert . throws ( function ( ) {
246
208
buf1 . copyToChannel ( "INVALID" , 0 , 0 ) ;
247
- } , function ( e ) {
248
- return e instanceof TypeError && / s h o u l d b e a F l o a t 3 2 A r r a y / . test ( e . message ) ;
249
- } ) ;
209
+ } , TypeError ) ;
250
210
251
211
assert . throws ( function ( ) {
252
212
buf1 . copyToChannel ( source , "INVALID" , 0 ) ;
253
- } , function ( e ) {
254
- return e instanceof TypeError && / s h o u l d b e a p o s i t i v e i n t e g e r / . test ( e . message ) ;
255
- } ) ;
213
+ } , TypeError ) ;
256
214
257
215
assert . throws ( function ( ) {
258
216
buf1 . copyToChannel ( source , 0 , "INVALID" ) ;
259
- } , function ( e ) {
260
- return e instanceof TypeError && / s h o u l d b e a p o s i t i v e i n t e g e r / . test ( e . message ) ;
261
- } ) ;
217
+ } , TypeError ) ;
262
218
263
219
assert . throws ( function ( ) {
264
220
buf1 . copyToChannel ( source , 10 , 0 ) ;
265
- } , function ( e ) {
266
- return e instanceof TypeError && / o u t s i d e t h e r a n g e / . test ( e . message ) ;
267
- } ) ;
221
+ } , TypeError ) ;
268
222
269
223
assert . throws ( function ( ) {
270
224
buf1 . copyToChannel ( source , 0 , 10 ) ;
271
- } , function ( e ) {
272
- return e instanceof TypeError && / o u t s i d e t h e r a n g e / . test ( e . message ) ;
273
- } ) ;
225
+ } , TypeError ) ;
274
226
275
227
assert . throws ( function ( ) {
276
228
buf1 . copyToChannel ( source , 0 , undefined ) ;
277
- } , function ( e ) {
278
- return e instanceof TypeError && / s h o u l d b e a p o s i t i v e i n t e g e r / . test ( e . message ) ;
279
- } ) ;
229
+ } , TypeError ) ;
280
230
281
231
WebAudioTestAPI . setState ( "AudioBuffer#copyToChannel" , "disabled" ) ;
282
232
0 commit comments