| 
									
										
										
										
											2020-07-03 14:39:25 -07:00
										 |  |  | test("assignment to function call", () => { | 
					
						
							| 
									
										
										
										
											2020-07-06 07:37:45 -07:00
										 |  |  |     expect(() => { | 
					
						
							|  |  |  |         function foo() {} | 
					
						
							|  |  |  |         foo() = "foo"; | 
					
						
							|  |  |  |     }).toThrowWithMessage(ReferenceError, "Invalid left-hand side in assignment"); | 
					
						
							| 
									
										
										
										
											2020-07-03 14:39:25 -07:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2020-04-10 00:39:33 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-05 00:00:10 +01:00
										 |  |  | test("assignment to function call in strict mode", () => { | 
					
						
							|  |  |  |     expect("'use strict'; foo() = 'foo'").not.toEval(); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-03 14:39:25 -07:00
										 |  |  | test("assignment to inline function call", () => { | 
					
						
							| 
									
										
										
										
											2020-07-06 07:37:45 -07:00
										 |  |  |     expect(() => { | 
					
						
							|  |  |  |         (function () {})() = "foo"; | 
					
						
							|  |  |  |     }).toThrowWithMessage(ReferenceError, "Invalid left-hand side in assignment"); | 
					
						
							| 
									
										
										
										
											2020-07-03 14:39:25 -07:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2020-10-04 23:58:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 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(); | 
					
						
							|  |  |  | }); |