mirror of https://github.com/tc39/test262.git
Create distinct tests for arguments object types
This commit is contained in:
parent
03f8ca8336
commit
92a735dad7
|
@ -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]
|
||||
---*/
|
||||
|
|
@ -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];
|
|
@ -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;
|
|
@ -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');
|
|
@ -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');
|
|
@ -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');
|
Loading…
Reference in New Issue