+describe("toFunctionName", () => {
+ it("[[Call]] works with strings and no prefix", () => {
+ assertStrictEquals(toFunctionName("etaoin"), "etaoin");
+ });
+
+ it("[[Call]] works with objects and no prefix", () => {
+ assertStrictEquals(
+ toFunctionName({
+ toString() {
+ return "etaoin";
+ },
+ }),
+ "etaoin",
+ );
+ });
+
+ it("[[Call]] works with descriptionless symbols and no prefix", () => {
+ assertStrictEquals(toFunctionName(Symbol()), "");
+ });
+
+ it("[[Call]] works with empty description symbols and no prefix", () => {
+ assertStrictEquals(toFunctionName(Symbol("")), "[]");
+ });
+
+ it("[[Call]] works with described symbols and no prefix", () => {
+ assertStrictEquals(toFunctionName(Symbol("etaoin")), "[etaoin]");
+ });
+
+ it("[[Call]] works with strings and a prefix", () => {
+ assertStrictEquals(toFunctionName("etaoin", "foo"), "foo etaoin");
+ });
+
+ it("[[Call]] works with objects and no prefix", () => {
+ assertStrictEquals(
+ toFunctionName({
+ toString() {
+ return "etaoin";
+ },
+ }, "foo"),
+ "foo etaoin",
+ );
+ });
+
+ it("[[Call]] works with descriptionless symbols and no prefix", () => {
+ assertStrictEquals(toFunctionName(Symbol(), "foo"), "foo ");
+ });
+
+ it("[[Call]] works with empty description symbols and no prefix", () => {
+ assertStrictEquals(toFunctionName(Symbol(""), "foo"), "foo []");
+ });
+
+ it("[[Call]] works with described symbols and no prefix", () => {
+ assertStrictEquals(
+ toFunctionName(Symbol("etaoin"), "foo"),
+ "foo [etaoin]",
+ );
+ });
+
+ it("[[Construct]] throws an error", () => {
+ assertThrows(() => new toFunctionName(""));
+ });
+
+ describe(".length", () => {
+ it("[[Get]] returns the correct length", () => {
+ assertStrictEquals(toFunctionName.length, 1);
+ });
+ });
+
+ describe(".name", () => {
+ it("[[Get]] returns the correct name", () => {
+ assertStrictEquals(
+ toFunctionName.name,
+ "toFunctionName",
+ );
+ });
+ });
+});
+