mirror of
				https://github.com/tc39/test262.git
				synced 2025-10-31 11:44:31 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			30 lines
		
	
	
		
			729 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			729 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| //@ runBigIntEnabled
 | |
| 
 | |
| assert = {
 | |
|     sameValue: function (input, expected, message) {
 | |
|         if (input !== expected)
 | |
|             throw new Error(message);
 | |
|     }
 | |
| };
 | |
| 
 | |
| let o = {
 | |
|     [Symbol.toPrimitive]: function() {
 | |
|         throw new Error("Bad");
 | |
|     }
 | |
| };
 | |
| 
 | |
| try{
 | |
|     o >> Symbol("2");
 | |
|     assert.sameValue(true, false, "Exception expected to be throwed, but executed without error");
 | |
| } catch (e) {
 | |
|     assert.sameValue(e.message, "Bad", "Expected to throw Error('Bad'), but got: " + e);
 | |
| }
 | |
| 
 | |
| try{
 | |
|     Symbol("2") >> o;
 | |
|     assert.sameValue(true, false, "Exception expected to be throwed, but executed without error");
 | |
| } catch (e) {
 | |
|     assert.sameValue(e instanceof TypeError, true, "Expected to throw TypeError, but got: " + e)
 | |
| }
 | |
| 
 |