| 
									
										
										
										
											2020-04-28 20:16:40 +01:00
										 |  |  | load("test-common.js"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | try { | 
					
						
							|  |  |  |     assertThrowsError(() => { | 
					
						
							|  |  |  |         for (var i = foo; i < 100; ++i) { | 
					
						
							|  |  |  |             assertNotReached(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     }, { | 
					
						
							|  |  |  |         error: ReferenceError, | 
					
						
							| 
									
										
										
										
											2020-06-09 22:48:01 -07:00
										 |  |  |         message: "'foo' is not defined" | 
					
						
							| 
									
										
										
										
											2020-04-28 20:16:40 +01:00
										 |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     assertThrowsError(() => { | 
					
						
							|  |  |  |         for (var i = 0; i < foo; ++i) { | 
					
						
							|  |  |  |             assertNotReached(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     }, { | 
					
						
							|  |  |  |         error: ReferenceError, | 
					
						
							| 
									
										
										
										
											2020-06-09 22:48:01 -07:00
										 |  |  |         message: "'foo' is not defined" | 
					
						
							| 
									
										
										
										
											2020-04-28 20:16:40 +01:00
										 |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     var loopCount = 0; | 
					
						
							|  |  |  |     assertThrowsError(() => { | 
					
						
							|  |  |  |         for (var i = 0; i < 100; ++foo) { | 
					
						
							|  |  |  |             loopCount++; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     }, { | 
					
						
							|  |  |  |         error: ReferenceError, | 
					
						
							| 
									
										
										
										
											2020-06-09 22:48:01 -07:00
										 |  |  |         message: "'foo' is not defined" | 
					
						
							| 
									
										
										
										
											2020-04-28 20:16:40 +01:00
										 |  |  |     }); | 
					
						
							|  |  |  |     assert(loopCount === 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     console.log("PASS"); | 
					
						
							|  |  |  | } catch (e) { | 
					
						
							|  |  |  |     console.log("FAIL: " + e); | 
					
						
							|  |  |  | } |