mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:37:34 +00:00
LibJS: Put exports before symbols in keys of module namespace object
This commit is contained in:
parent
fb61e9274a
commit
3b56043612
3 changed files with 27 additions and 4 deletions
|
@ -182,6 +182,10 @@ describe("in- and exports", () => {
|
|||
test("can import with (useless) assertions", () => {
|
||||
expectModulePassed("./import-with-assertions.mjs");
|
||||
});
|
||||
|
||||
test("namespace has expected ordering", () => {
|
||||
expectModulePassed("./namespace-order.mjs");
|
||||
});
|
||||
});
|
||||
|
||||
describe("loops", () => {
|
||||
|
|
16
Userland/Libraries/LibJS/Tests/modules/namespace-order.mjs
Normal file
16
Userland/Libraries/LibJS/Tests/modules/namespace-order.mjs
Normal file
|
@ -0,0 +1,16 @@
|
|||
import * as ns from "./default-and-star-export.mjs";
|
||||
|
||||
const keys = Reflect.ownKeys(ns);
|
||||
// The keys should be in alphabetical order and @@toString at the end
|
||||
if (keys.length < 4) throw new Error("Expected at least 3 keys and @@toStringTag");
|
||||
|
||||
if (keys[0] !== "") throw new Error('Expected keys[0] === ""');
|
||||
|
||||
if (keys[1] !== "*") throw new Error('Expected keys[1] === "*"');
|
||||
|
||||
if (keys[2] !== "default") throw new Error('Expected keys[2] === "default"');
|
||||
|
||||
if (keys.indexOf(Symbol.toStringTag) <= 2)
|
||||
throw new Error("Expected Symbol.toStringTag to be behind string keys");
|
||||
|
||||
export const passed = true;
|
Loading…
Add table
Add a link
Reference in a new issue