2022-11-23 01:31:03 +01:00
|
|
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
/*---
|
|
|
|
description: |
|
|
|
|
The 'asyncTest' helper checks that it is called with the 'async' flag.
|
|
|
|
includes: [asyncHelpers.js]
|
|
|
|
---*/
|
|
|
|
function makePromise() {
|
|
|
|
return {
|
|
|
|
then(res, rej) {
|
2023-02-10 21:25:20 +01:00
|
|
|
// Throw a different error than Test262Error to avoid confusion about what is rejecting
|
|
|
|
throw new Error("Should not be evaluated");
|
2022-11-23 01:31:03 +01:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
assert(
|
|
|
|
!Object.hasOwn(globalThis, "$DONE"),
|
|
|
|
"Without 'async' flag, $DONE should not be defined"
|
|
|
|
);
|
|
|
|
assert.throws(Test262Error, function () {
|
|
|
|
asyncTest(makePromise);
|
|
|
|
});
|