@ -45,8 +45,11 @@ function assertHasOwnProperty(object, name, attrs) {
function TestArrayPrototype ( ) {
function TestArrayPrototype ( ) {
assertHasOwnProperty ( Array . prototype , 'entries' , DONT_ENUM ) ;
assertHasOwnProperty ( Array . prototype , 'entries' , DONT_ENUM ) ;
assertHasOwnProperty ( Array . prototype , 'values' , DONT_ENUM ) ;
assertHasOwnProperty ( Array . prototype , 'keys' , DONT_ENUM ) ;
assertHasOwnProperty ( Array . prototype , 'keys' , DONT_ENUM ) ;
assertHasOwnProperty ( Array . prototype , Symbol . iterator , DONT_ENUM ) ;
assertHasOwnProperty ( Array . prototype , Symbol . iterator , DONT_ENUM ) ;
assertEquals ( Array . prototype . values , Array . prototype [ Symbol . iterator ] ) ;
}
}
TestArrayPrototype ( ) ;
TestArrayPrototype ( ) ;
@ -58,7 +61,7 @@ function assertIteratorResult(value, done, result) {
function TestValues ( ) {
function TestValues ( ) {
var array = [ 'a' , 'b' , 'c' ] ;
var array = [ 'a' , 'b' , 'c' ] ;
var iterator = array [ Symbol . iterator ] ( ) ;
var iterator = array . values ( ) ;
assertIteratorResult ( 'a' , false , iterator . next ( ) ) ;
assertIteratorResult ( 'a' , false , iterator . next ( ) ) ;
assertIteratorResult ( 'b' , false , iterator . next ( ) ) ;
assertIteratorResult ( 'b' , false , iterator . next ( ) ) ;
assertIteratorResult ( 'c' , false , iterator . next ( ) ) ;
assertIteratorResult ( 'c' , false , iterator . next ( ) ) ;
@ -72,7 +75,7 @@ TestValues();
function TestValuesMutate ( ) {
function TestValuesMutate ( ) {
var array = [ 'a' , 'b' , 'c' ] ;
var array = [ 'a' , 'b' , 'c' ] ;
var iterator = array [ Symbol . iterator ] ( ) ;
var iterator = array . values ( ) ;
assertIteratorResult ( 'a' , false , iterator . next ( ) ) ;
assertIteratorResult ( 'a' , false , iterator . next ( ) ) ;
assertIteratorResult ( 'b' , false , iterator . next ( ) ) ;
assertIteratorResult ( 'b' , false , iterator . next ( ) ) ;
assertIteratorResult ( 'c' , false , iterator . next ( ) ) ;
assertIteratorResult ( 'c' , false , iterator . next ( ) ) ;
@ -139,17 +142,17 @@ TestEntriesMutate();
function TestArrayIteratorPrototype ( ) {
function TestArrayIteratorPrototype ( ) {
var array = [ ] ;
var array = [ ] ;
var iterator = array . key s( ) ;
var iterator = array . value s( ) ;
var ArrayIteratorPrototype = iterator . __ proto__ ;
var ArrayIteratorPrototype = iterator . __ proto__ ;
assertEquals ( ArrayIteratorPrototype , array [ Symbol . iterator ] ( ) . __ proto__ ) ;
assertEquals ( ArrayIteratorPrototype , array . values ( ) . __ proto__ ) ;
assertEquals ( ArrayIteratorPrototype , array . keys ( ) . __ proto__ ) ;
assertEquals ( ArrayIteratorPrototype , array . keys ( ) . __ proto__ ) ;
assertEquals ( ArrayIteratorPrototype , array . entries ( ) . __ proto__ ) ;
assertEquals ( ArrayIteratorPrototype , array . entries ( ) . __ proto__ ) ;
assertEquals ( Object . prototype , ArrayIteratorPrototype . __ proto__ ) ;
assertEquals ( Object . prototype , ArrayIteratorPrototype . __ proto__ ) ;
assertEquals ( 'Array Iterator' , % _ ClassOf ( array [ Symbol . iterator ] ( ) ) ) ;
assertEquals ( 'Array Iterator' , % _ ClassOf ( array . values ( ) ) ) ;
assertEquals ( 'Array Iterator' , % _ ClassOf ( array . keys ( ) ) ) ;
assertEquals ( 'Array Iterator' , % _ ClassOf ( array . keys ( ) ) ) ;
assertEquals ( 'Array Iterator' , % _ ClassOf ( array . entries ( ) ) ) ;
assertEquals ( 'Array Iterator' , % _ ClassOf ( array . entries ( ) ) ) ;
@ -166,7 +169,7 @@ function TestForArrayValues() {
var buffer = [ ] ;
var buffer = [ ] ;
var array = [ 0 , 'a' , true , false , null , /* hole */ , undefined , NaN ] ;
var array = [ 0 , 'a' , true , false , null , /* hole */ , undefined , NaN ] ;
var i = 0 ;
var i = 0 ;
for ( var value of array [ Symbol . iterator ] ( ) ) {
for ( var value of array . values ( ) ) {
buffer [ i ++ ] = value ;
buffer [ i ++ ] = value ;
}
}
@ -239,7 +242,7 @@ TestForArrayValues();
function TestNonOwnSlots ( ) {
function TestNonOwnSlots ( ) {
var array = [ 0 ] ;
var array = [ 0 ] ;
var iterator = array [ Symbol . iterator ] ( ) ;
var iterator = array . values ( ) ;
var object = { __ proto__ : iterator } ;
var object = { __ proto__ : iterator } ;
assertThrows ( function ( ) {
assertThrows ( function ( ) {