Skip to content
Snippets Groups Projects
Unverified Commit b0e9db88 authored by Rick Waldron's avatar Rick Waldron Committed by Leonardo Balter
Browse files

Remove invalid tests on parameters vs arguments list

Ref #822
parent 238f4caa
No related branches found
No related tags found
No related merge requests found
// Copyright (C) 2016 Jeff Morrison. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Check that trailing commas do not affect `arguments` in function
expression bodies.
info: http://jeffmo.github.io/es-trailing-function-commas/
author: Jeff Morrison <lbljeffmo@gmail.com>
---*/
var f1 = function() {
assert.sameValue(
arguments.length,
1,
"Function expression called with 1 arg + trailing comma reports " +
"invalid arguments.length!"
);
};
f1(1,);
var f2 = function() {
assert.sameValue(
arguments.length,
2,
"Function expression called with 2 arg + trailing comma reports " +
"invalid arguments.length!"
);
};
f2(1,2,);
// Copyright (C) 2016 Jeff Morrison. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Check that trailing commas do not affect `arguments` in function
expression bodies.
info: http://jeffmo.github.io/es-trailing-function-commas/
author: Jeff Morrison <lbljeffmo@gmail.com>
---*/
var f1 = function*() {
assert.sameValue(
arguments.length,
1,
"Function expression called with 1 arg + trailing comma reports " +
"invalid arguments.length!"
);
};
f1(1,).next();
var f2 = function*() {
assert.sameValue(
arguments.length,
2,
"Function expression called with 2 arg + trailing comma reports " +
"invalid arguments.length!"
);
};
f2(1,2,).next();
// Copyright (C) 2016 Jeff Morrison. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Check that trailing parameter commas do not affect `arguments` in object
method bodies.
info: http://jeffmo.github.io/es-trailing-function-commas/
author: Jeff Morrison <lbljeffmo@gmail.com>
---*/
var obj = {
f1() {
assert.sameValue(
arguments.length,
1,
"Object method called with 1 arg + trailing comma reports " +
"invalid arguments.length!"
);
},
f2() {
assert.sameValue(
arguments.length,
2,
"Object method called with 2 arg + trailing comma reports " +
"invalid arguments.length!"
);
}
};
obj.f1(1,);
obj.f2(1,2,);
// Copyright (C) 2016 Jeff Morrison. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Check that trailing commas in method parameter lists do not affect `arguments`
in class method bodies.
info: http://jeffmo.github.io/es-trailing-function-commas/
author: Jeff Morrison <lbljeffmo@gmail.com>
---*/
class C {
f1() {
assert.sameValue(
arguments.length,
1,
"Class method called with 1 arg + trailing comma reports " +
"invalid arguments.length!"
);
}
f2() {
assert.sameValue(
arguments.length,
2,
"Class method called with 2 arg + trailing comma reports " +
"invalid arguments.length!"
);
}
};
(new C()).f1(1,);
(new C()).f2(1,2,);
// Copyright (C) 2016 Jeff Morrison. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Check that trailing commas do not affect `arguments` in function
declaration bodies.
info: http://jeffmo.github.io/es-trailing-function-commas/
author: Jeff Morrison <lbljeffmo@gmail.com>
---*/
function f1() {
assert.sameValue(
arguments.length,
1,
"Function declaration called with 1 arg + trailing comma reports " +
"invalid arguments.length!"
);
}
function f2() {
assert.sameValue(
arguments.length,
2,
"Function declaration called with 2 arg + trailing comma reports " +
"invalid arguments.length!"
);
}
f1(1,);
f2(1,2,);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment