
We can't just to_string() the PropertyName, it might be a symbol. Instead to_value() it and then use to_string_without_side_effects() as usual. Fixes #4062.
12 lines
451 B
JavaScript
12 lines
451 B
JavaScript
"use strict";
|
|
|
|
test("basic functionality", () => {
|
|
[true, false, "foo", 123].forEach(primitive => {
|
|
expect(() => {
|
|
primitive.foo = "bar";
|
|
}).toThrowWithMessage(TypeError, "Cannot assign property foo to primitive value");
|
|
expect(() => {
|
|
primitive[Symbol.hasInstance] = 123;
|
|
}).toThrowWithMessage(TypeError, "Cannot assign property Symbol(Symbol.hasInstance) to primitive value");
|
|
});
|
|
});
|