LibJS: Implement Symbol.toStringTag

This commit is contained in:
Matthew Olsson 2020-07-11 10:27:00 -07:00 committed by Andreas Kling
commit 43d955014d
Notes: sideshowbarker 2024-07-19 04:56:14 +09:00
11 changed files with 55 additions and 0 deletions

View file

@ -2,6 +2,11 @@ test("length", () => {
expect(Array.prototype[Symbol.iterator].length).toBe(0);
});
test("@@toStringTag", () => {
expect([].values()[Symbol.toStringTag]).toBe("Array Iterator");
expect([].values().toString()).toBe("[object Array Iterator]");
});
test("same function as Array.prototype.values", () => {
expect(Array.prototype[Symbol.iterator]).toBe(Array.prototype.values);
});