1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-23 23:45:07 +00:00
serenity/Libraries/LibJS/Tests/builtins/Symbol/Symbol.js
2020-07-03 19:30:13 +02:00

26 lines
526 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);
}