1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 11:17:43 +00:00
serenity/Libraries/LibJS/Tests/builtins/Symbol/Symbol.js
2020-07-06 23:40:35 +02:00

29 lines
509 B
JavaScript

load("test-common.js");
try {
const s1 = Symbol("foo");
const s2 = Symbol("foo");
assert(s1 !== s2);
assert(s1.description === "foo");
assert(s2.description === "foo");
s1.description = "bar";
assert(s1.description === "foo");
assert(typeof s1 === "symbol");
assertThrowsError(
() => {
Symbol(Symbol("foo"));
},
{
error: TypeError,
message: "Cannot convert symbol to string",
}
);
console.log("PASS");
} catch (e) {
console.log("FAIL: " + e);
}