mirror of
				https://github.com/tc39/test262.git
				synced 2025-10-31 03:34:08 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			20 lines
		
	
	
		
			434 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			434 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| // Reviewed
 | |
| function test() {
 | |
| 
 | |
| var a = {}, b = {}, c = {};
 | |
| var passed = 0;
 | |
| a[Symbol.toPrimitive] = function(hint) { passed += hint === "number";  return 0; };
 | |
| b[Symbol.toPrimitive] = function(hint) { passed += hint === "string";  return 0; };
 | |
| c[Symbol.toPrimitive] = function(hint) { passed += hint === "default"; return 0; };
 | |
| 
 | |
| a >= 0;
 | |
| b in {};
 | |
| c == 0;
 | |
| return passed === 3;
 | |
|       
 | |
| }
 | |
| 
 | |
| if (!test())
 | |
|     throw new Error("Test failed");
 | |
| 
 |