
Now, exceptions can be thrown with interpreter.throw_exception<T>(ErrorType:TYPE, "format", "args", "here").
26 lines
526 B
JavaScript
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);
|
|
}
|