mirror of
				https://github.com/tc39/test262.git
				synced 2025-10-27 01:33:59 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			15 lines
		
	
	
		
			388 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			388 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| // Reviewed
 | |
| function shouldBe(actual, expected) {
 | |
|     if (actual !== expected)
 | |
|         throw new Error('bad value: ' + actual);
 | |
| }
 | |
| 
 | |
| class DerivedPromise extends Promise {
 | |
|     static get [Symbol.species]() {
 | |
|         return Promise;
 | |
|     }
 | |
| }
 | |
| 
 | |
| shouldBe(DerivedPromise.all([ 1, 2, 3]) instanceof DerivedPromise, true);
 | |
| shouldBe(DerivedPromise.race([ 1, 2, 3]) instanceof DerivedPromise, true);
 |