diff --git a/test/language/statements/for-of/arguments-object-aliasing.js b/test/language/statements/for-of/arguments-mapped-aliasing.js similarity index 63% rename from test/language/statements/for-of/arguments-object-aliasing.js rename to test/language/statements/for-of/arguments-mapped-aliasing.js index 8528e85224..c3c39154c5 100644 --- a/test/language/statements/for-of/arguments-object-aliasing.js +++ b/test/language/statements/for-of/arguments-mapped-aliasing.js @@ -3,9 +3,11 @@ /*--- es6id: 13.6.4 description: > - Arguments objects should be able to be traversed using a `for..of` loop, - and dynamic changes to their contents should be reflected in the iterated - values. + Mapped arguments object mutation via alias during traversal using for..of +info: > + "Mapped" arguments objects should be able to be traversed using a `for..of` + loop, and dynamic changes to the formal parameters should be reflected in + the iterated values. flags: [noStrict] ---*/ diff --git a/test/language/statements/for-of/arguments-object-mutation.js b/test/language/statements/for-of/arguments-mapped-mutation.js similarity index 60% rename from test/language/statements/for-of/arguments-object-mutation.js rename to test/language/statements/for-of/arguments-mapped-mutation.js index 6d9a0334ca..9191d4d827 100644 --- a/test/language/statements/for-of/arguments-object-mutation.js +++ b/test/language/statements/for-of/arguments-mapped-mutation.js @@ -2,10 +2,12 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- es6id: 13.6.4 -description: > - Arguments objects should be able to be traversed using a `for..of` loop, - and dynamic changes to their contents should be reflected in the iterated - values. +description: Mapped arguments object mutation during traversal using for..of +info: > + "Mapped" arguments objects should be able to be traversed using a `for..of` + loop, and dynamic changes to their contents should be reflected in the + iterated values. +flags: [noStrict] ---*/ var expected = [1, 4, 6]; diff --git a/test/language/statements/for-of/arguments-object.js b/test/language/statements/for-of/arguments-mapped.js similarity index 69% rename from test/language/statements/for-of/arguments-object.js rename to test/language/statements/for-of/arguments-mapped.js index 6c04da407f..58923c573a 100644 --- a/test/language/statements/for-of/arguments-object.js +++ b/test/language/statements/for-of/arguments-mapped.js @@ -2,8 +2,11 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- es6id: 13.6.4 -description: > - Arguments objects should be able to be traversed using a `for..of` loop. +description: Mapped arguments object traversal using for..of +info: > + "Mapped" arguments objects should be able to be traversed using a `for..of` + loop. +flags: [noStrict] ---*/ var i = 0; diff --git a/test/language/statements/for-of/arguments-unmapped-aliasing.js b/test/language/statements/for-of/arguments-unmapped-aliasing.js new file mode 100644 index 0000000000..fac40f2ac7 --- /dev/null +++ b/test/language/statements/for-of/arguments-unmapped-aliasing.js @@ -0,0 +1,29 @@ +// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.6.4 +description: > + Unmapped arguments object mutation via alias during traversal using for..of +info: > + "Unmapped" arguments objects should be able to be traversed using a + `for..of` loop, and dynamic changes to the formal parameters should not be + reflected in the iterated values. +flags: [noStrict] +---*/ + +var expected = [1, 2, 3]; +var i = 0; + +(function(a, b, c) { + 'use strict'; + for (var value of arguments) { + a = b; + b = c; + c = i; + assert.sameValue(value, expected[i], 'argument at index ' + i); + i++; + } + +}(1, 2, 3)); + +assert.sameValue(i, 3, 'Visits all arguments'); diff --git a/test/language/statements/for-of/arguments-unmapped-mutation.js b/test/language/statements/for-of/arguments-unmapped-mutation.js new file mode 100644 index 0000000000..9c4f441ba7 --- /dev/null +++ b/test/language/statements/for-of/arguments-unmapped-mutation.js @@ -0,0 +1,25 @@ +// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.6.4 +description: Unmapped arguments object mutation during traversal using for..of +info: > + "Unmapped" arguments objects should be able to be traversed using a + `for..of` loop, and dynamic changes to their contents should be reflected + in the iterated values. +flags: [noStrict] +---*/ + +var expected = [1, 4, 6]; +var i = 0; + +(function() { + 'use strict'; + for (var value of arguments) { + assert.sameValue(value, expected[i], 'argument at index ' + i); + i++; + arguments[i] *= 2; + } +}(1, 2, 3)); + +assert.sameValue(i, 3, 'Visits all arguments'); diff --git a/test/language/statements/for-of/arguments-unmapped.js b/test/language/statements/for-of/arguments-unmapped.js new file mode 100644 index 0000000000..21020a7af8 --- /dev/null +++ b/test/language/statements/for-of/arguments-unmapped.js @@ -0,0 +1,22 @@ +// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.6.4 +description: Unmapped arguments object traversal using for..of +info: > + "Umapped" arguments objects should be able to be traversed using a + `for..of` loop. +flags: [noStrict] +---*/ + +var i = 0; + +(function() { + 'use strict'; + for (var value of arguments) { + assert.sameValue(value, arguments[i], 'argument at index ' + i); + i++; + } +}(0, 'a', true, false, null, undefined, NaN)); + +assert.sameValue(i, 7, 'Visits all arguments');