diff options
Diffstat (limited to 'Userland/Libraries/LibJS/Tests/strict-mode-errors.js')
-rw-r--r-- | Userland/Libraries/LibJS/Tests/strict-mode-errors.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Tests/strict-mode-errors.js b/Userland/Libraries/LibJS/Tests/strict-mode-errors.js new file mode 100644 index 0000000000..ada52e359f --- /dev/null +++ b/Userland/Libraries/LibJS/Tests/strict-mode-errors.js @@ -0,0 +1,15 @@ +"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" + ); + }); +}); |