Skip to content

Commit

Permalink
update tc39_test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
petamoriken committed Apr 22, 2024
1 parent 5d8f58d commit 0de111e
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions testing/unit/tc39_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,38 @@ test(function testIteratorHelpers() {
}
});

// Verify that the "Temporal" proposal is enabled
test(function testTemporalEnabled() {
// Verify that "Set methods" proposal is enabled (https://github.com/tc39/proposal-set-methods)
test(function testIteratorHelpers() {
// @ts-expect-error: Not available in TypeScript yet
const a: Set<number> = new Set([1, 2, 3]).intersection(new Set([3, 4, 5]));
if (a.size !== 1 && !a.has(3)) {
fail("failed");
}
});

// Verify that the "Temporal" proposal is enabled (https://github.com/tc39/proposal-temporal)
test(function testTemporal() {
// @ts-expect-error: Not available in TypeScript yet
assert(typeof Temporal !== "undefined");
});

// Verify that the "Explicit Resource Management" proposal is enabled (https://github.com/tc39/proposal-explicit-resource-management)
test(function testExplicitResourceManagement() {
assert(typeof SuppressedError !== "undefined");
assert(typeof Symbol.dispose !== "undefined");
assert(typeof Symbol.asyncDispose !== "undefined");
// DisposableStack and AsyncDisposableStack are not yet implemented
// assert(typeof DisposableStack !== "undefined");
// assert(typeof AsyncDisposableStack !== "undefined");
});

// Verify that the "Float16Array" proposal is enabled (https://github.com/tc39/proposal-float16array)
test(function testFloat16Array() {
// @ts-expect-error: Not available in TypeScript yet
const a = new Float16Array([Math.PI]);
assert(a[0] === 3.140625);
// @ts-expect-error: Not available in TypeScript yet
assert(typeof DataView.prototype.getFloat16 !== "undefined");
// @ts-expect-error: Not available in TypeScript yet
assert(typeof DataView.prototype.setFloat16 !== "undefined");
});

0 comments on commit 0de111e

Please sign in to comment.