Debian Codegraph @

js/src/tests/test262/harness/asyncHelpers-asyncTest-func-throws-sync.js

raw
1 // Copyright (C) 2022 Igalia, S.L. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 description: |
5 The 'asyncTest' helper reports synchronous errors via $DONE.
6 includes: [asyncHelpers.js]
7 ---*/
8 var called = false;
9 var msg = "Should not be rethrown";
10 function $DONE(error) {
11 called = true;
12 assert(error instanceof Test262Error);
13 assert.sameValue(error.message, msg, "Should report correct error");
14 }
15 asyncTest(function () {
16 throw new Test262Error(msg);
17 });
18 assert(called, "asyncTest called $DONE with a synchronously thrown error");
19
20 reportCompare(0, 0);