From: Lady Date: Mon, 4 Sep 2023 22:37:35 +0000 (-0400) Subject: Test function lengths in {value∣function∣symbol}.js X-Git-Url: https://git.ladys.computer/Pisces/commitdiff_plain/8d8a95ad49519ca4c2e1867760f12cc56d2c2c94?ds=sidebyside Test function lengths in {value∣function∣symbol}.js --- diff --git a/function.test.js b/function.test.js index 75ba300..1165d03 100644 --- a/function.test.js +++ b/function.test.js @@ -77,6 +77,12 @@ describe("bind", () => { assertThrows(() => new bind(function () {})); }); + describe(".length", () => { + it("[[Get]] returns the correct length", () => { + assertStrictEquals(bind.length, 3); + }); + }); + describe(".name", () => { it("[[Get]] returns the correct name", () => { assertStrictEquals(bind.name, "bind"); @@ -133,6 +139,12 @@ describe("call", () => { assertThrows(() => new call(function () {}, null, [])); }); + describe(".length", () => { + it("[[Get]] returns the correct length", () => { + assertStrictEquals(call.length, 3); + }); + }); + describe(".name", () => { it("[[Get]] returns the correct name", () => { assertStrictEquals(call.name, "call"); @@ -166,6 +178,12 @@ describe("completesNormally", () => { assertThrows(() => new completesNormally(function () {})); }); + describe(".length", () => { + it("[[Get]] returns the correct length", () => { + assertStrictEquals(completesNormally.length, 1); + }); + }); + describe(".name", () => { it("[[Get]] returns the correct name", () => { assertStrictEquals(completesNormally.name, "completesNormally"); @@ -234,6 +252,12 @@ describe("construct", () => { assertThrows(() => new construct(function () {}, [])); }); + describe(".length", () => { + it("[[Get]] returns the correct length", () => { + assertStrictEquals(construct.length, 2); + }); + }); + describe(".name", () => { it("[[Get]] returns the correct name", () => { assertStrictEquals(construct.name, "construct"); @@ -268,6 +292,12 @@ describe("createCallableFunction", () => { assertThrows(() => new createCallableFunction(function () {})); }); + describe(".length", () => { + it("[[Get]] returns the correct length", () => { + assertStrictEquals(createCallableFunction.length, 1); + }); + }); + describe(".name", () => { it("[[Get]] returns the correct name", () => { assertStrictEquals( @@ -374,6 +404,12 @@ describe("createIllegalConstructor", () => { }); }); + describe(".length", () => { + it("[[Get]] returns the correct length", () => { + assertStrictEquals(createIllegalConstructor.length, 1); + }); + }); + describe(".name", () => { it("[[Get]] returns the correct name", () => { assertStrictEquals( @@ -400,6 +436,12 @@ describe("identity", () => { assertStrictEquals(new class extends identity {}(value), value); }); + describe(".length", () => { + it("[[Get]] returns the correct length", () => { + assertStrictEquals(identity.length, 1); + }); + }); + describe(".name", () => { it("[[Get]] returns the correct name", () => { assertStrictEquals(identity.name, "identity"); @@ -466,6 +508,12 @@ describe("isCallable", () => { assertThrows(() => new isCallable(function () {})); }); + describe(".length", () => { + it("[[Get]] returns the correct length", () => { + assertStrictEquals(isCallable.length, 1); + }); + }); + describe(".name", () => { it("[[Get]] returns the correct name", () => { assertStrictEquals(isCallable.name, "isCallable"); @@ -532,6 +580,12 @@ describe("isConstructor", () => { assertThrows(() => new isConstructor(function () {})); }); + describe(".length", () => { + it("[[Get]] returns the correct length", () => { + assertStrictEquals(isConstructor.length, 1); + }); + }); + describe(".name", () => { it("[[Get]] returns the correct name", () => { assertStrictEquals(isConstructor.name, "isConstructor"); @@ -559,6 +613,12 @@ describe("ordinaryHasInstance", () => { assertThrows(() => new ordinaryHasInstance(function () {}, {})); }); + describe(".length", () => { + it("[[Get]] returns the correct length", () => { + assertStrictEquals(ordinaryHasInstance.length, 2); + }); + }); + describe(".name", () => { it("[[Get]] returns the correct name", () => { assertStrictEquals( @@ -631,6 +691,12 @@ describe("toFunctionName", () => { assertThrows(() => new toFunctionName("")); }); + describe(".length", () => { + it("[[Get]] returns the correct length", () => { + assertStrictEquals(toFunctionName.length, 1); + }); + }); + describe(".name", () => { it("[[Get]] returns the correct name", () => { assertStrictEquals( diff --git a/symbol.test.js b/symbol.test.js index 38d7425..03abffc 100644 --- a/symbol.test.js +++ b/symbol.test.js @@ -39,6 +39,12 @@ describe("getSymbolDescription", () => { assertThrows(() => new getSymbolDescription(Symbol())); }); + describe(".length", () => { + it("[[Get]] returns the correct length", () => { + assertStrictEquals(getSymbolDescription.length, 1); + }); + }); + describe(".name", () => { it("[[Get]] returns the correct name", () => { assertStrictEquals( @@ -69,6 +75,12 @@ describe("symbolToString", () => { assertThrows(() => new symbolToString(Symbol())); }); + describe(".length", () => { + it("[[Get]] returns the correct length", () => { + assertStrictEquals(symbolToString.length, 1); + }); + }); + describe(".name", () => { it("[[Get]] returns the correct name", () => { assertStrictEquals( @@ -110,6 +122,12 @@ describe("symbolValue", () => { assertThrows(() => new symbolValue(Symbol())); }); + describe(".length", () => { + it("[[Get]] returns the correct length", () => { + assertStrictEquals(symbolValue.length, 1); + }); + }); + describe(".name", () => { it("[[Get]] returns the correct name", () => { assertStrictEquals( diff --git a/value.test.js b/value.test.js index 1be5950..ae2b7d8 100644 --- a/value.test.js +++ b/value.test.js @@ -206,6 +206,12 @@ describe("ordinaryToPrimitive", () => { assertThrows(() => new ordinaryToPrimitive("")); }); + describe(".length", () => { + it("[[Get]] returns the correct length", () => { + assertStrictEquals(ordinaryToPrimitive.length, 2); + }); + }); + describe(".name", () => { it("[[Get]] returns the correct name", () => { assertStrictEquals( @@ -258,6 +264,12 @@ describe("sameValue", () => { assertThrows(() => new sameValue(true, true)); }); + describe(".length", () => { + it("[[Get]] returns the correct length", () => { + assertStrictEquals(sameValue.length, 2); + }); + }); + describe(".name", () => { it("[[Get]] returns the correct name", () => { assertStrictEquals(sameValue.name, "sameValue"); @@ -310,6 +322,12 @@ describe("sameValueZero", () => { assertThrows(() => new sameValueZero(true, true)); }); + describe(".length", () => { + it("[[Get]] returns the correct length", () => { + assertStrictEquals(sameValueZero.length, 2); + }); + }); + describe(".name", () => { it("[[Get]] returns the correct name", () => { assertStrictEquals(sameValueZero.name, "sameValueZero"); @@ -417,6 +435,12 @@ describe("toPrimitive", () => { assertThrows(() => new toPrimitive(true)); }); + describe(".length", () => { + it("[[Get]] returns the correct length", () => { + assertStrictEquals(toPrimitive.length, 1); + }); + }); + describe(".name", () => { it("[[Get]] returns the correct name", () => { assertStrictEquals(toPrimitive.name, "toPrimitive"); @@ -449,6 +473,12 @@ describe("type", () => { assertThrows(() => new type({})); }); + describe(".length", () => { + it("[[Get]] returns the correct length", () => { + assertStrictEquals(type.length, 1); + }); + }); + describe(".name", () => { it("[[Get]] returns the correct name", () => { assertStrictEquals(type.name, "type");