OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --expose-wasm | 5 // Flags: --expose-wasm |
6 | 6 |
7 function bytes() { | 7 function bytes() { |
8 var buffer = new ArrayBuffer(arguments.length); | 8 var buffer = new ArrayBuffer(arguments.length); |
9 var view = new Uint8Array(buffer); | 9 var view = new Uint8Array(buffer); |
10 for (var i = 0; i < arguments.length; i++) { | 10 for (var i = 0; i < arguments.length; i++) { |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 function assertTraps(trap, code) { | 283 function assertTraps(trap, code) { |
284 var threwException = true; | 284 var threwException = true; |
285 try { | 285 try { |
286 if (typeof code === 'function') { | 286 if (typeof code === 'function') { |
287 code(); | 287 code(); |
288 } else { | 288 } else { |
289 eval(code); | 289 eval(code); |
290 } | 290 } |
291 threwException = false; | 291 threwException = false; |
292 } catch (e) { | 292 } catch (e) { |
293 assertEquals("string", typeof e); | 293 assertEquals("object", typeof e); |
294 assertEquals(kTrapMsgs[trap], e); | 294 assertEquals(kTrapMsgs[trap], e.message); |
295 // Success. | 295 // Success. |
296 return; | 296 return; |
297 } | 297 } |
298 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap]
); | 298 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap]
); |
299 } | 299 } |
OLD | NEW |