-
Notifications
You must be signed in to change notification settings - Fork 514
Add script to generate standard property tests #4535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
anba
wants to merge
8
commits into
tc39:main
Choose a base branch
from
anba:generated-builtin
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0166442
Add harness functions to verify built-in functions and constructors
anba 9ad1b2b
Ignore generated files from other test generators
anba c5351e4
Add script to generate property tests
anba cfe8c2a
Generate standard property tests for Number
anba b012d8e
Generate standard property tests for ECMA-402 Number overrides
anba 933d746
Remove Number tests now covered by automatically generated tests
anba 3b224c4
Remove assertions covered by automatically generated tests
anba 8b5cdbc
Add property tests for Uint8Array to/from base64 proposal
anba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,29 @@ | ||
| // Test generated by: property-test-generator | ||
|
|
||
| /*--- | ||
| esid: sec-number.epsilon | ||
| description: Property test for Number.EPSILON | ||
| info: | | ||
| Number.EPSILON | ||
| - The value of `Number.EPSILON` is the Number value for the magnitude of the | ||
| difference between 1 and the smallest value greater than 1 that is | ||
| representable as a Number value, which is approximately | ||
| 2.2204460492503130808472633361816 × 10-16. | ||
| - This property has the attributes { [[Writable]]: false, [[Enumerable]]: | ||
| false, [[Configurable]]: false }. | ||
|
|
||
| ECMAScript Standard Built-in Objects | ||
|
|
||
| Every other data property described in clauses 19 through 28 and in Annex B.2 | ||
| has the attributes { [[Writable]]: true, [[Enumerable]]: false, | ||
| [[Configurable]]: true } unless otherwise specified. | ||
| flags: [generated] | ||
| includes: [propertyHelper.js] | ||
| ---*/ | ||
|
|
||
| verifyPrimordialProperty(Number, "EPSILON", { | ||
| value: 2.2204460492503130808472633361816e-16, | ||
| writable: false, | ||
| enumerable: false, | ||
| configurable: false, | ||
| }); |
This file contains hidden or 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,26 @@ | ||
| // Test generated by: property-test-generator | ||
|
|
||
| /*--- | ||
| esid: sec-number.max_safe_integer | ||
| description: Property test for Number.MAX_SAFE_INTEGER | ||
| info: | | ||
| Number.MAX_SAFE_INTEGER | ||
| - The value of `Number.MAX_SAFE_INTEGER` is 9007199254740991𝔽 (𝔽(253 - 1)). | ||
| - This property has the attributes { [[Writable]]: false, [[Enumerable]]: | ||
| false, [[Configurable]]: false }. | ||
|
|
||
| ECMAScript Standard Built-in Objects | ||
|
|
||
| Every other data property described in clauses 19 through 28 and in Annex B.2 | ||
| has the attributes { [[Writable]]: true, [[Enumerable]]: false, | ||
| [[Configurable]]: true } unless otherwise specified. | ||
| flags: [generated] | ||
| includes: [propertyHelper.js] | ||
| ---*/ | ||
|
|
||
| verifyPrimordialProperty(Number, "MAX_SAFE_INTEGER", { | ||
| value: 9007199254740991, | ||
| writable: false, | ||
| enumerable: false, | ||
| configurable: false, | ||
| }); | ||
This file contains hidden or 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,27 @@ | ||
| // Test generated by: property-test-generator | ||
|
|
||
| /*--- | ||
| esid: sec-number.max_value | ||
| description: Property test for Number.MAX_VALUE | ||
| info: | | ||
| Number.MAX_VALUE | ||
| - The value of `Number.MAX_VALUE` is the largest positive finite value of the | ||
| Number type, which is approximately 1.7976931348623157 × 10308. | ||
| - This property has the attributes { [[Writable]]: false, [[Enumerable]]: | ||
| false, [[Configurable]]: false }. | ||
|
|
||
| ECMAScript Standard Built-in Objects | ||
|
|
||
| Every other data property described in clauses 19 through 28 and in Annex B.2 | ||
| has the attributes { [[Writable]]: true, [[Enumerable]]: false, | ||
| [[Configurable]]: true } unless otherwise specified. | ||
| flags: [generated] | ||
| includes: [propertyHelper.js] | ||
| ---*/ | ||
|
|
||
| verifyPrimordialProperty(Number, "MAX_VALUE", { | ||
| value: 1.7976931348623157e308, | ||
| writable: false, | ||
| enumerable: false, | ||
| configurable: false, | ||
| }); |
This file contains hidden or 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,27 @@ | ||
| // Test generated by: property-test-generator | ||
|
|
||
| /*--- | ||
| esid: sec-number.min_safe_integer | ||
| description: Property test for Number.MIN_SAFE_INTEGER | ||
| info: | | ||
| Number.MIN_SAFE_INTEGER | ||
| - The value of `Number.MIN_SAFE_INTEGER` is -9007199254740991𝔽 (𝔽(-(253 - | ||
| 1))). | ||
| - This property has the attributes { [[Writable]]: false, [[Enumerable]]: | ||
| false, [[Configurable]]: false }. | ||
|
|
||
| ECMAScript Standard Built-in Objects | ||
|
|
||
| Every other data property described in clauses 19 through 28 and in Annex B.2 | ||
| has the attributes { [[Writable]]: true, [[Enumerable]]: false, | ||
| [[Configurable]]: true } unless otherwise specified. | ||
| flags: [generated] | ||
| includes: [propertyHelper.js] | ||
| ---*/ | ||
|
|
||
| verifyPrimordialProperty(Number, "MIN_SAFE_INTEGER", { | ||
| value: -9007199254740991, | ||
| writable: false, | ||
| enumerable: false, | ||
| configurable: false, | ||
| }); |
This file contains hidden or 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,32 @@ | ||
| // Test generated by: property-test-generator | ||
|
|
||
| /*--- | ||
| esid: sec-number.min_value | ||
| description: Property test for Number.MIN_VALUE | ||
| info: | | ||
| Number.MIN_VALUE | ||
| - The value of `Number.MIN_VALUE` is the smallest positive value of the Number | ||
| type, which is approximately 5 × 10-324. | ||
| - In the IEEE 754-2019 double precision binary representation, the smallest | ||
| possible value is a denormalized number. If an implementation does not | ||
| support denormalized values, the value of `Number.MIN_VALUE` must be the | ||
| smallest non-zero positive value that can actually be represented by the | ||
| implementation. | ||
| - This property has the attributes { [[Writable]]: false, [[Enumerable]]: | ||
| false, [[Configurable]]: false }. | ||
|
|
||
| ECMAScript Standard Built-in Objects | ||
|
|
||
| Every other data property described in clauses 19 through 28 and in Annex B.2 | ||
| has the attributes { [[Writable]]: true, [[Enumerable]]: false, | ||
| [[Configurable]]: true } unless otherwise specified. | ||
| flags: [generated] | ||
| includes: [propertyHelper.js] | ||
| ---*/ | ||
|
|
||
| verifyPrimordialProperty(Number, "MIN_VALUE", { | ||
| value: 5e-324, | ||
| writable: false, | ||
| enumerable: false, | ||
| configurable: false, | ||
| }); |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,18 +1,26 @@ | ||
| // Copyright (C) 2016 The V8 Project authors. All rights reserved. | ||
| // This code is governed by the BSD license found in the LICENSE file. | ||
| // Test generated by: property-test-generator | ||
|
|
||
| /*--- | ||
| esid: sec-number.negative_infinity | ||
| description: > | ||
| "NEGATIVE_INFINITY" property of Number | ||
| description: Property test for Number.NEGATIVE_INFINITY | ||
| info: | | ||
| Number.NEGATIVE_INFINITY | ||
| - The value of `Number.NEGATIVE_INFINITY` is -∞𝔽. | ||
| - This property has the attributes { [[Writable]]: false, [[Enumerable]]: | ||
| false, [[Configurable]]: false }. | ||
|
|
||
| This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, | ||
| [[Configurable]]: false }. | ||
| ECMAScript Standard Built-in Objects | ||
|
|
||
| Every other data property described in clauses 19 through 28 and in Annex B.2 | ||
| has the attributes { [[Writable]]: true, [[Enumerable]]: false, | ||
| [[Configurable]]: true } unless otherwise specified. | ||
| flags: [generated] | ||
| includes: [propertyHelper.js] | ||
| ---*/ | ||
|
|
||
| verifyNotEnumerable(Number, "NEGATIVE_INFINITY"); | ||
| verifyNotWritable(Number, "NEGATIVE_INFINITY"); | ||
| verifyNotConfigurable(Number, "NEGATIVE_INFINITY"); | ||
| verifyPrimordialProperty(Number, "NEGATIVE_INFINITY", { | ||
| value: -1/0, | ||
| writable: false, | ||
| enumerable: false, | ||
| configurable: false, | ||
| }); |
This file contains hidden or 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,26 @@ | ||
| // Test generated by: property-test-generator | ||
|
|
||
| /*--- | ||
| esid: sec-number.nan | ||
| description: Property test for Number.NaN | ||
| info: | | ||
| Number.NaN | ||
| - The value of `Number.NaN` is NaN. | ||
| - This property has the attributes { [[Writable]]: false, [[Enumerable]]: | ||
| false, [[Configurable]]: false }. | ||
|
|
||
| ECMAScript Standard Built-in Objects | ||
|
|
||
| Every other data property described in clauses 19 through 28 and in Annex B.2 | ||
| has the attributes { [[Writable]]: true, [[Enumerable]]: false, | ||
| [[Configurable]]: true } unless otherwise specified. | ||
| flags: [generated] | ||
| includes: [propertyHelper.js] | ||
| ---*/ | ||
|
|
||
| verifyPrimordialProperty(Number, "NaN", { | ||
| value: 0/0, | ||
| writable: false, | ||
| enumerable: false, | ||
| configurable: false, | ||
| }); |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,18 +1,26 @@ | ||
| // Copyright (C) 2016 The V8 Project authors. All rights reserved. | ||
| // This code is governed by the BSD license found in the LICENSE file. | ||
| // Test generated by: property-test-generator | ||
|
|
||
| /*--- | ||
| esid: sec-number.positive_infinity | ||
| description: > | ||
| "POSITIVE_INFINITY" property of Number | ||
| description: Property test for Number.POSITIVE_INFINITY | ||
| info: | | ||
| Number.POSITIVE_INFINITY | ||
| - The value of `Number.POSITIVE_INFINITY` is +∞𝔽. | ||
| - This property has the attributes { [[Writable]]: false, [[Enumerable]]: | ||
| false, [[Configurable]]: false }. | ||
|
|
||
| This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, | ||
| [[Configurable]]: false }. | ||
| ECMAScript Standard Built-in Objects | ||
|
|
||
| Every other data property described in clauses 19 through 28 and in Annex B.2 | ||
| has the attributes { [[Writable]]: true, [[Enumerable]]: false, | ||
| [[Configurable]]: true } unless otherwise specified. | ||
| flags: [generated] | ||
| includes: [propertyHelper.js] | ||
| ---*/ | ||
|
|
||
| verifyNotEnumerable(Number, "POSITIVE_INFINITY"); | ||
| verifyNotWritable(Number, "POSITIVE_INFINITY"); | ||
| verifyNotConfigurable(Number, "POSITIVE_INFINITY"); | ||
| verifyPrimordialProperty(Number, "POSITIVE_INFINITY", { | ||
| value: 1/0, | ||
| writable: false, | ||
| enumerable: false, | ||
| configurable: false, | ||
| }); |
This file contains hidden or 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,18 @@ | ||
| // Test generated by: property-test-generator | ||
|
|
||
| /*--- | ||
| esid: sec-number-constructor | ||
| description: Property test for Number | ||
| info: | | ||
| The Number Constructor | ||
|
|
||
| Number ( value ) | ||
|
|
||
| Properties of the Number Constructor | ||
| - has a [[Prototype]] internal slot whose value is %Function.prototype%. | ||
| flags: [generated] | ||
| includes: [builtin.js, propertyHelper.js] | ||
| features: [Proxy, Reflect, Reflect.construct] | ||
| ---*/ | ||
|
|
||
| verifyBuiltinConstructor(Number, "Number", 1, Function.prototype); |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,21 +1,26 @@ | ||
| // Copyright (C) 2016 The V8 Project authors. All rights reserved. | ||
| // This code is governed by the BSD license found in the LICENSE file. | ||
| // Test generated by: property-test-generator | ||
|
|
||
| /*--- | ||
| esid: sec-number.isfinite | ||
| description: > | ||
| "isFinite" property of Number | ||
| description: Property test for Number.isFinite | ||
| info: | | ||
| 17 ECMAScript Standard Built-in Objects: | ||
| Number.isFinite ( number ) | ||
|
|
||
| Every other data property described in clauses 18 through 26 and in Annex B.2 | ||
| ECMAScript Standard Built-in Objects | ||
|
|
||
| Every other data property described in clauses 19 through 28 and in Annex B.2 | ||
| has the attributes { [[Writable]]: true, [[Enumerable]]: false, | ||
| [[Configurable]]: true } unless otherwise specified. | ||
| includes: [propertyHelper.js] | ||
| flags: [generated] | ||
| includes: [builtin.js, propertyHelper.js] | ||
| features: [Proxy, Reflect, Reflect.construct] | ||
| ---*/ | ||
|
|
||
| verifyProperty(Number, "isFinite", { | ||
| verifyBuiltinFunction(Number.isFinite, "isFinite", 1); | ||
|
|
||
| verifyPrimordialProperty(Number, "isFinite", { | ||
| value: Number.isFinite, | ||
| writable: true, | ||
| enumerable: false, | ||
| configurable: true | ||
| configurable: true, | ||
| }); |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,21 +1,26 @@ | ||
| // Copyright (C) 2016 The V8 Project authors. All rights reserved. | ||
| // This code is governed by the BSD license found in the LICENSE file. | ||
| // Test generated by: property-test-generator | ||
|
|
||
| /*--- | ||
| esid: sec-number.isinteger | ||
| description: > | ||
| "isInteger" property of Number | ||
| description: Property test for Number.isInteger | ||
| info: | | ||
| 17 ECMAScript Standard Built-in Objects: | ||
| Number.isInteger ( number ) | ||
|
|
||
| Every other data property described in clauses 18 through 26 and in Annex B.2 | ||
| ECMAScript Standard Built-in Objects | ||
|
|
||
| Every other data property described in clauses 19 through 28 and in Annex B.2 | ||
| has the attributes { [[Writable]]: true, [[Enumerable]]: false, | ||
| [[Configurable]]: true } unless otherwise specified. | ||
| includes: [propertyHelper.js] | ||
| flags: [generated] | ||
| includes: [builtin.js, propertyHelper.js] | ||
| features: [Proxy, Reflect, Reflect.construct] | ||
| ---*/ | ||
|
|
||
| verifyProperty(Number, "isInteger", { | ||
| verifyBuiltinFunction(Number.isInteger, "isInteger", 1); | ||
|
|
||
| verifyPrimordialProperty(Number, "isInteger", { | ||
| value: Number.isInteger, | ||
| writable: true, | ||
| enumerable: false, | ||
| configurable: true | ||
| configurable: true, | ||
| }); |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,21 +1,26 @@ | ||
| // Copyright (C) 2016 The V8 Project authors. All rights reserved. | ||
| // This code is governed by the BSD license found in the LICENSE file. | ||
| // Test generated by: property-test-generator | ||
|
|
||
| /*--- | ||
| esid: sec-number.isnan | ||
| description: > | ||
| "isNaN" property of Number | ||
| description: Property test for Number.isNaN | ||
| info: | | ||
| 17 ECMAScript Standard Built-in Objects: | ||
| Number.isNaN ( number ) | ||
|
|
||
| Every other data property described in clauses 18 through 26 and in Annex B.2 | ||
| ECMAScript Standard Built-in Objects | ||
|
|
||
| Every other data property described in clauses 19 through 28 and in Annex B.2 | ||
| has the attributes { [[Writable]]: true, [[Enumerable]]: false, | ||
| [[Configurable]]: true } unless otherwise specified. | ||
| includes: [propertyHelper.js] | ||
| flags: [generated] | ||
| includes: [builtin.js, propertyHelper.js] | ||
| features: [Proxy, Reflect, Reflect.construct] | ||
| ---*/ | ||
|
|
||
| verifyProperty(Number, "isNaN", { | ||
| verifyBuiltinFunction(Number.isNaN, "isNaN", 1); | ||
|
|
||
| verifyPrimordialProperty(Number, "isNaN", { | ||
| value: Number.isNaN, | ||
| writable: true, | ||
| enumerable: false, | ||
| configurable: true | ||
| configurable: true, | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, that's quite a confusing way to render
2**53.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, fixing this will require rewriting
<sup>tags to some other representation.This the source code from spec.html:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're already doing this as of tc39/ecmarkup#517 . For example, the text at https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-number.max_safe_integer now copies as