mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:27:35 +00:00
Libraries: Move to Userland/Libraries/
This commit is contained in:
parent
dc28c07fa5
commit
13d7c09125
1857 changed files with 266 additions and 274 deletions
32
Userland/Libraries/LibJS/Tests/invalid-lhs-in-assignment.js
Normal file
32
Userland/Libraries/LibJS/Tests/invalid-lhs-in-assignment.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
test("assignment to function call", () => {
|
||||
expect(() => {
|
||||
function foo() {}
|
||||
foo() = "foo";
|
||||
}).toThrowWithMessage(ReferenceError, "Invalid left-hand side in assignment");
|
||||
});
|
||||
|
||||
test("assignment to function call in strict mode", () => {
|
||||
expect("'use strict'; foo() = 'foo'").not.toEval();
|
||||
});
|
||||
|
||||
test("assignment to inline function call", () => {
|
||||
expect(() => {
|
||||
(function () {})() = "foo";
|
||||
}).toThrowWithMessage(ReferenceError, "Invalid left-hand side in assignment");
|
||||
});
|
||||
|
||||
test("assignment to invalid LHS is syntax error", () => {
|
||||
expect("1 += 1").not.toEval();
|
||||
expect("1 -= 1").not.toEval();
|
||||
expect("1 *= 1").not.toEval();
|
||||
expect("1 /= 1").not.toEval();
|
||||
expect("1 %= 1").not.toEval();
|
||||
expect("1 **= 1").not.toEval();
|
||||
expect("1 &= 1").not.toEval();
|
||||
expect("1 |= 1").not.toEval();
|
||||
expect("1 ^= 1").not.toEval();
|
||||
expect("1 <<= 1").not.toEval();
|
||||
expect("1 >>= 1").not.toEval();
|
||||
expect("1 >>>= 1").not.toEval();
|
||||
expect("1 = 1").not.toEval();
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue