mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 16:32:45 +00:00 
			
		
		
		
	 9e32ad6c99
			
		
	
	
		9e32ad6c99
		
	
	
	
	
		
			
			With this, typing `"\xff"` into Browser's console no longer makes the app crash. While here, also make the \u handler call append_codepoint() instead of calling an overload where it's not immediately clear which overload is getting called. This has no behavior change.
		
			
				
	
	
		
			15 lines
		
	
	
	
		
			442 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
	
		
			442 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| test("hex escapes", () => {
 | |
|     expect("\x55").toBe("U");
 | |
|     expect("X55").toBe("X55");
 | |
|     expect(`\x55`).toBe("U");
 | |
|     expect(`\X55`).toBe("X55");
 | |
|     expect("\xff").toBe(String.fromCharCode(0xff));
 | |
| });
 | |
| 
 | |
| test("unicode escapes", () => {
 | |
|     expect("\u26a0").toBe("⚠");
 | |
|     expect(`\u26a0`).toBe("⚠");
 | |
|     expect("\u{1f41e}").toBe("🐞");
 | |
|     expect(`\u{1f41e}`).toBe("🐞");
 | |
|     expect("\u00ff").toBe(String.fromCharCode(0xff));
 | |
| });
 |