-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for Function.prototype.caller and arguments properties
- Loading branch information
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); |