mirror of
				https://github.com/tc39/test262.git
				synced 2025-11-04 05:33:50 +01:00 
			
		
		
		
	commit c56030aea7b3e43f46dbbc2b52859ca275cff226
Author: Rick Waldron <waldron.rick@gmail.com>
Date:   Thu Apr 30 15:17:44 2015 -0400
    Fix nits
commit 9b341022a9fd5a295ce85b630886dae10e10b653
Author: Rick Waldron <waldron.rick@gmail.com>
Date:   Tue Apr 28 13:52:04 2015 -0400
    Wrap expected construct failure in assert.throws
commit 9ef7e1c0499a99b15c64bb480dbfa41433cf9804
Author: Mike Pennisi <mike@mikepennisi.com>
Date:   Fri Apr 24 13:46:02 2015 -0400
    Introduce addition tests for the Set constructor
commit bd54cccf4a599c123fae5c97782f5562cd9da8a0
Author: Rick Waldron <waldron.rick@gmail.com>
Date:   Fri Apr 24 15:11:19 2015 -0400
    23.2 Set Objects, additions
commit 970e2ca95879161a8bb124ec712f7333fdea6798
Author: Rick Waldron <waldron.rick@gmail.com>
Date:   Tue Apr 21 12:44:41 2015 -0400
    23.2 Set Objects
		
	
			
		
			
				
	
	
		
			35 lines
		
	
	
		
			996 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			996 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
// Copyright (C) 2015 the V8 project authors. All rights reserved.
 | 
						|
// This code is governed by the BSD license found in the LICENSE file.
 | 
						|
/*---
 | 
						|
es6id: 23.2.1.1
 | 
						|
description: >
 | 
						|
    Set ( [ iterable ] )
 | 
						|
 | 
						|
    When the Set function is called with optional argument iterable the following steps are taken:
 | 
						|
 | 
						|
    ...
 | 
						|
    7. Else,
 | 
						|
      a. Let adder be Get(set, "add").
 | 
						|
      b. ReturnIfAbrupt(adder).
 | 
						|
      c. If IsCallable(adder) is false, throw a TypeError exception.
 | 
						|
      d. Let iter be GetIterator(iterable).
 | 
						|
      e. ReturnIfAbrupt(iter).
 | 
						|
    ...
 | 
						|
    9. Repeat
 | 
						|
      a. Let next be IteratorStep(iter).
 | 
						|
      b. ReturnIfAbrupt(next).
 | 
						|
      c. If next is false, return set.
 | 
						|
      d. Let nextValue be IteratorValue(next).
 | 
						|
      e. ReturnIfAbrupt(nextValue).
 | 
						|
      f. Let status be Call(adder, set, «nextValue.[[value]]»).
 | 
						|
      g. If status is an abrupt completion, return IteratorClose(iter, status).
 | 
						|
 | 
						|
---*/
 | 
						|
 | 
						|
 | 
						|
Set.prototype.add = null;
 | 
						|
 | 
						|
assert.throws(TypeError, function() {
 | 
						|
  new Set([1, 2]);
 | 
						|
});
 |