Skip to content

Commit

Permalink
Add tests for Function.prototype.caller and arguments properties
Browse files Browse the repository at this point in the history
  • Loading branch information
jdorfman committed Dec 20, 2024
1 parent 1c42cfc commit 9875dd4
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/built-ins/Function/prototype/arguments/prop-desc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (C) 2024 Justin Dorfman. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-function.prototype.arguments
description: >
Function.prototype.arguments property descriptor
info: |
Function.prototype.arguments is an accessor property whose set and get
accessor functions are both %ThrowTypeError%.
includes: [propertyHelper.js]
---*/

const argumentsDesc = Object.getOwnPropertyDescriptor(Function.prototype, 'arguments');

verifyProperty(Function.prototype, "arguments", {
enumerable: false,
configurable: true
});

assert.sameValue(typeof argumentsDesc.get, "function",
"Function.prototype.arguments has function getter");
assert.sameValue(typeof argumentsDesc.set, "function",
"Function.prototype.arguments has function setter");
assert.sameValue(argumentsDesc.get, argumentsDesc.set,
"Arguments property getter/setter are the same function");
25 changes: 25 additions & 0 deletions test/built-ins/Function/prototype/caller/prop-desc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (C) 2024 Justin Dorfman. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-function.prototype.caller
description: >
Function.prototype.caller property descriptor
info: |
Function.prototype.caller is an accessor property whose set and get
accessor functions are both %ThrowTypeError%.
includes: [propertyHelper.js]
---*/

const callerDesc = Object.getOwnPropertyDescriptor(Function.prototype, 'caller');

verifyProperty(Function.prototype, "caller", {
enumerable: false,
configurable: true
});

assert.sameValue(typeof callerDesc.get, "function",
"Function.prototype.caller has function getter");
assert.sameValue(typeof callerDesc.set, "function",
"Function.prototype.caller has function setter");
assert.sameValue(callerDesc.get, callerDesc.set,
"Caller property getter/setter are the same function");

0 comments on commit 9875dd4

Please sign in to comment.