mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 08:32:43 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			36 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <script src="../include.js"></script>
 | |
| <script>
 | |
|     test(() => {
 | |
|         println(structuredClone(new Boolean(true)));
 | |
|         println(structuredClone(new Boolean(false)));
 | |
|         println(structuredClone(new Number(123)));
 | |
|         println(structuredClone(new Number(123.456)));
 | |
|         println(structuredClone(new String("This is a String object")));
 | |
|         println(structuredClone(BigInt("0x1fffffffffffff")));
 | |
|         println(structuredClone(Date.UTC(2023, 7, 23)));
 | |
|         println(structuredClone(/abc/gimsuy));
 | |
| 
 | |
|         {
 | |
|             let arrayBuffer = new ArrayBuffer(6);
 | |
|             for (let i = 0; i < arrayBuffer.byteLength; ++i) {
 | |
|                 arrayBuffer[i] = i;
 | |
|             }
 | |
|             let arrayClone = structuredClone(arrayBuffer);
 | |
|             for (let i = 0; i < arrayBuffer.byteLength; ++i) {
 | |
|                 if (arrayBuffer[i] !== arrayBuffer[i]) {
 | |
|                     println("FAILED");
 | |
|                 }
 | |
|             }
 | |
|             // FIXME: This should print something like ArrayBuffer { byteLength: 6 }
 | |
|             println(arrayClone);
 | |
|         }
 | |
| 
 | |
|         try {
 | |
|             structuredClone(Symbol("foo"));
 | |
|             println("FAILED")
 | |
|         }
 | |
|         catch(e) {
 | |
|             println("ERROR: " + e.name + ": " + e.message)
 | |
|         }
 | |
|     });
 | |
| </script>
 | 
