+
+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(".name", () => {
+ it("[[Get]] returns the correct name", () => {
+ assertStrictEquals(
+ toFunctionName.name,
+ "toFunctionName",
+ );
+ });
+ });
+});