mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 17:22:43 +00:00 
			
		
		
		
	 b4e51249e9
			
		
	
	
		b4e51249e9
		
	
	
	
	
		
			
			https://tc39.es/ecma262/#sec-additions-and-changes-that-introduce-incompatibilities-with-prior-editions 11.9.1: In ECMAScript 2015, Automatic Semicolon Insertion adds a semicolon at the end of a do-while statement if the semicolon is missing. This change aligns the specification with the actual behaviour of most existing implementations.
		
			
				
	
	
		
			24 lines
		
	
	
	
		
			488 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
	
		
			488 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| test("basic functionality", () => {
 | |
|     let number = 0;
 | |
|     do {
 | |
|         number++;
 | |
|     } while (number < 9);
 | |
|     expect(number).toBe(9);
 | |
| });
 | |
| 
 | |
| test("no braces", () => {
 | |
|     let number = 0;
 | |
|     do number++;
 | |
|     while (number < 3);
 | |
|     expect(number).toBe(3);
 | |
| });
 | |
| 
 | |
| test("exception in test expression", () => {
 | |
|     expect(() => {
 | |
|         do {} while (foo);
 | |
|     }).toThrow(ReferenceError);
 | |
| });
 | |
| 
 | |
| test("automatic semicolon insertion", () => {
 | |
|     expect("do {} while (false) foo").toEval();
 | |
| });
 |