Commit Graph

1404 Commits

Author SHA1 Message Date
Kevin Gibbons b42d184876 update descriptions for existing duplicate-capture-groups tests 2022-08-09 12:15:49 -07:00
legendecas ee521159d5 Fix decorator tests 2022-06-23 15:17:43 -04:00
Youssef Soliman 79c4496559 Fixed spelling error identifer -> identifier. 2022-06-21 10:14:17 +02:00
Mike Pennisi 74de3d1d32 Correct spurious syntax errors
Prior to this commit, two tests for specific early errors also included
syntactically invalid `const` declarations. Implementations which
produced the expected syntax error due to these invalid declarations
would pass the tests regardless of whether they produced the early
errors that the tests were written to verify.

Correct the `const` declarations so that the tests verify the parsing
rule that they were designed to verify.
2022-06-17 10:29:52 +02:00
Dmitriy Kubyshkin ba5529d926
Fix wrong error for a lexical redeclaration test (#3575)
The test as originally specified fails in all compatible parsers, but for the wrong reason. Below is an excerpt from V8, but all parser I tested behave the same:

```js
for (const x; false; ) {
           ^
SyntaxError: Missing initializer in const declaration
```

After the change the error is the assumed:

```js
  var x;
      ^
SyntaxError: Identifier 'x' has already been declared
```
2022-06-16 22:24:51 -04:00
Huáng Jùnliàng 79e3bc5176
add noStrict flag to yield-as-binding-id cases (#3551) 2022-06-09 09:01:21 +02:00
legendecas 6f8e0f67ca Decorators: add initial tests on class 2022-05-18 09:49:49 -04:00
Keith Miller b409843612 Update S12.6.4_A7_T2.js
This test currently has some tabs. Clean this up and make them spaces instead.
2022-05-05 10:19:37 -07:00
rwaldron f60d7cf67d fixup! Fix false negative in for-in test 2022-04-05 11:18:45 -04:00
rwaldron 384a4e1368 Fix false negative in for-in test
As originally written, this test would spuriously pass when the deleted
property was incorrectly visited by enumation but correctly removed from
the object. In such cases, the accumulator string would take the form

    "aa1baundefinedca3"

And satisfy all conditions intended to highlight implementation errors.

Refactor the test to avoid false negative by using an object with a null
prototype and verifying the exact contents of the accumulator string.
2022-04-05 11:18:10 -04:00
Mike Pennisi 3c88e9b619 Fix false negative in for-in test
As originally written, this test would spuriously pass when the deleted
property was incorrectly visited by enumation but correctly removed from
the object. In such cases, the accumulator string would take the form

    "aa1baundefinedca3"

And satisfy all conditions intended to highlight implementation errors.

Refactor the test to avoid false negative by using an object with a null
prototype and verifying the exact contents of the accumulator string.
2022-04-05 11:15:21 -04:00
Richard Gibson c58ac691eb Test that "infinity" is not recognized as numeric 2022-04-04 16:56:40 -04:00
Richard Gibson c572588ea9 Test that "INFINITY" is not recognized as numeric
Fixes #3442
2022-04-04 16:56:40 -04:00
Philip Chimento 615a2eb9a1 Fix tests for private reference with logical assignment
There were three things wrong with the 'and', 'or', and 'nullish' tests
that I added as part of #2940:

1. They were in the wrong folder (should be
   expressions/logical-assignment, not expressions/compound-assignment)
2. The tests for ||= and ??= on readonly accessor properties were
   incorrect. These assignments would short-circuit if the getter
   returned 1 as it previously did, so PutValue would not throw.
3. The tests for ||= and ??= on private methods were invalid, as a
   method always evaluates to true in a boolean context, and is not
   nullish, so these would always short-circuit.

I've removed the invalid private method cases, fixed the readonly
accessor cases, and added new templates to test the short-circuit
behaviour as well as the non-short-circuit behaviour.

Closes: #3413
2022-02-21 15:38:59 -05:00
Philip Chimento 1b1097dbf6 Add tests for compound assignment to private reference
This tests compound assignment, with each compound assignment operator,
to each kind of private reference (private field, private accessor
property with getter and setter, private accessor property with only
getter, and private method). The latter two cannot be assigned to and
therefore throw.

Closes: #2940
2022-02-16 09:56:59 -05:00
Csaba Osztrogonác 00f682e746 tools: enforce restriction on YAML negative key
The phase field must precede the type field for negative tests
to have a consistent style and be able to parse easier.
Related to the goal of https://github.com/tc39/test262/issues/1997

Added this check to the linting script and updated tests accordingly.
2022-01-10 13:50:38 -05:00
Mathias Bynens f864edbc1c Add identifier tests for private class fields specifically
@bathos discovered that multiple engines implement this incorrectly:
https://twitter.com/bhathos/status/1478370049303928832

With that in mind, it’s probably worth adding some test coverage.
Test generator patch: https://github.com/mathiasbynens/caniunicode/pull/6
2022-01-05 14:24:20 -05:00
Mike Pennisi f782971ad2 Remove harness file, arrayContains.js
The `arrayContains` function has a number of deficiencies which make it
inappropriate for Test262:

- It apparently isn't very useful: despite being available for over 7
  years, fewer than ten tests use it
- It's misleading: its documentation reads, "Verify that a subArray is
  contained within an array." In reality, it only verifies that all the
  elements of one array are present in another--order does not matter.
- It's not ergonomic for test authors: it has been misused to create
  tests that were prone to false positives [1]
- It's not ergonomic for implementers: ostensibly designed for use with
  `assert`, the failure messages produced by tests that use it do not
  necessarily have very much context

All code in the "harness" directory adds to the total amount of
project-specific information which contributors are expected to to
learn. In light of the above deficiencies, the burden of this particular
harness file is unjustified.

Remove the harness file and its associated tests. Update the tests which
depend on it to express their expectations using alternate methods, and
strengthen the tests to assert element order wherever appropriate.

[1] https://github.com/tc39/test262/pull/3289
2021-11-01 12:55:10 -04:00
Daniel Nalborczyk 100af9014e generate tests 2021-10-22 09:00:00 -04:00
Rick Waldron 8b4382d2f2
Transform compareArray -> assert.compareArray: test/language/**/*.js (#3239) 2021-10-15 20:35:01 -04:00
Mathias Bynens 5d3eed6433
Add tests for Unicode v14 Identifier{Start,Part} (#3198)
Issue: https://github.com/tc39/ecma262/issues/2514
2021-10-15 20:19:22 -04:00
Mike Pennisi 8d420cef41 Remove unused functions 2021-10-13 14:18:32 -04:00
Rick Waldron 7be8fca485
fix: re-run clean and build on master to sync generated tests (#3247) 2021-10-06 15:47:46 -04:00
Mike Pennisi 891b7915bd Remove superfluous EmptyStatement 2021-10-05 16:28:06 -04:00
Mike Pennisi 8f1fb5c257 Remove unused functions 2021-10-05 16:24:16 -04:00
Mike Pennisi a6834093aa Improve coverage by invoking functions as intended
Some tests which include function declarations designed to verify
behavior do not reference those functions. Insert the references
necessary for those functions to serve their intended purpose.
2021-10-05 16:22:56 -04:00
rwaldron 43c68163c0 Generate tests 2021-10-01 16:38:56 -04:00
Mike Pennisi d9ddf80479 Revert "Merge pull request #3219 from tc39/rwaldron/migrate-comparearray"
This reverts commit b690cb67be, reversing
changes made to 50dd431dff. This is
necessary because the reverted changeset reduced coverage by an unknown
extent.
2021-10-01 10:18:47 -04:00
rwaldron 4847d9db5a chore: update test/**/*.js to use assert.compareArray wherever applicable 2021-09-24 12:58:15 -04:00
Mathieu Hofman 5fee61c9e8
Add test for freezing of module namespace object (#3213)
Attempting to freeze the module namespace exotic object should not affect the `writable`-ity of the properties as that exercises the same `DefineOwnProperty` operation according to [`SetIntegrityLevel`](https://tc39.es/ecma262/#sec-setintegritylevel).

@erights discovered a [bug in v8](https://bugs.chromium.org/p/v8/issues/detail?id=12240) where, while the `Object.freeze` operation throws, it actually makes exported properties non-writable one by one.

At the request of @syg, I'm contributing a test against this behavior. The bug in v8 actually leads to a breakage of the objects invariants, however I'm not testing for that here as the root cause is the illegal freezing of the export.
2021-09-23 19:36:37 -04:00
Mike Pennisi 650e7add4a Improve coverage for ops involving negative zero
Prior to this commit, the modified tests used the strict equality
operator to compare computed values with negative zero. Due to the
semantics of that operator, these tests would spuriously pass if the
value under test was in fact positive zero.

Update the tests to be more precise by instead asserting equality with
the `assert.sameValue` utility method (since that method correctly
distinguishes between negative zero and positive zero).
2021-09-16 16:35:41 -04:00
Mike Pennisi 93ecde9f3a Correct typo to improve coverage
Prior to this commit, the modified test included two different
expressions in positions that were meant to describe the same
expression. This meant that the value of the intended expression was
only partially verified.

Correct the test to fully verify the value of the expression.
2021-09-16 16:34:28 -04:00
Mike Pennisi 4a7830beec Remove TCO tests invalidated by normative change
Normative: Define default constructors using spec steps
https://github.com/tc39/ecma262/pull/2216

Resolves https://github.com/tc39/test262/issues/2978
2021-09-07 17:51:10 -04:00
Mike Pennisi 2a898fe819 Add test for normative change to BlockStatement
Normative: continue labels should not pass through blocks
https://github.com/tc39/ecma262/pull/2482
2021-09-07 17:50:02 -04:00
Mike Pennisi 47ab262658 Throw distinctive errors for different failures
Prior to this patch, two distinct failure cases would produce the same
generic error message. Refactor the test logic to report the specific
condition which trigger failure.
2021-09-02 10:36:00 -04:00
Mickey Rose 603b10dbfa
avoid unnecessary calls to decimalToHexString() (#3170) 2021-09-01 17:26:54 -04:00
jugglinmike 49347e0cf9
Remove unreachable code (#3165)
* Remove unreachable code

* fixup! Remove unreachable code
2021-08-25 16:13:00 -04:00
legendecas 206a3f4932 fixup! add other function variants 2021-08-25 10:32:55 -04:00
legendecas c1c1ed47db fixup! 2021-08-25 10:32:55 -04:00
legendecas ddff7c5ded Add test for duplicated top level function declarations in modules 2021-08-25 10:32:55 -04:00
rwaldron 85aa16c4c0 Generate tests 2021-08-19 11:52:55 -04:00
André Bargull 47be34cef7 Split files which test for the property order of functions
So SpiderMonkey can run the other parts of these tests.
2021-08-05 18:23:52 -04:00
André Bargull d00039593d Add various private field and private method tests
This adds tests for implementation bugs in SpiderMonkey [1], plus
additional tests for implementation bugs in V8 and JSC.

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1723155
2021-08-04 15:06:38 -04:00
André Bargull b74b15c49c
Derived class constructor checks are executed after leaving the function body (#3129) 2021-08-04 09:58:24 -07:00
rwaldron 8afbeda683 chore: migrate $ERROR -> throw new Test262Error in test/language/expressions/assignment/white-space.js 2021-07-29 15:21:12 -04:00
rwaldron 4a125f2f4e chore: migrate $ERROR -> throw new Test262Error in test/language/s* 2021-07-29 10:38:53 -04:00
Rick Waldron 64a4b76c62
chore: migrate $ERROR -> throw new Test262Error in test/language/e* (#3098) 2021-07-28 13:48:39 -07:00
Rick Waldron e5ab3a572e
chore: migrate $ERROR -> throw new Test262Error in test/language/f* (#3099) 2021-07-28 13:47:49 -07:00
Rick Waldron 0947f287ae
chore: migrate $ERROR -> throw new Test262Error in test/language/g* (#3101) 2021-07-28 13:47:15 -07:00
Rick Waldron f4914e133e
chore: migrate $ERROR -> throw new Test262Error in test/language/i* (#3102) 2021-07-28 13:46:58 -07:00
Rick Waldron 77fe50f174
chore: migrate $ERROR -> throw new Test262Error in test/language/line-terminators/* (#3103) 2021-07-28 13:46:23 -07:00
Rick Waldron 323233be54
chore: migrate $ERROR -> throw new Test262Error in test/language/l* (#3104)
Excludes test/language/line-terminators/*
2021-07-28 13:45:44 -07:00
Rick Waldron 2dcd653272
chore: migrate $ERROR -> throw new Test262Error in test/language/t* (#3106) 2021-07-28 13:44:19 -07:00
Rick Waldron 2581a439a5
chore: migrate $ERROR -> throw new Test262Error in test/language/white-space/* (#3107) 2021-07-28 13:43:40 -07:00
rwaldron 77cc528526 Generate tests 2021-07-22 15:31:36 -04:00
Rick Waldron e5fe379157
chore: migrate $ERROR -> throw new Test262Error in test/language/c* (#3097) 2021-07-21 14:02:21 -07:00
Rick Waldron 582d5e57ca
chore: migrate $ERROR -> throw new Test262Error in test/language/a* (#3095) 2021-07-21 13:42:51 -07:00
devsnek 80678e0bed Update identifier-strict-recursive.js 2021-07-20 10:33:29 -04:00
devsnek 2be28ba0c8 add test that delete early error is recursive 2021-07-20 10:33:29 -04:00
Mike Pennisi 3b06fd012a Update test for deletion of SuperProperty
The following proposed change modifies the semantics this test was
originally written to verify:

Normative: Allow null or undefined in Reference Records
https://github.com/tc39/ecma262/pull/2267
2021-07-19 13:28:09 -04:00
Richard Gibson 39026ea655 Add generated tests
Fixes #3039
2021-07-16 09:49:17 -04:00
Timothy Gu 6319cb1e2a Add more static class property ordering tests
Since https://github.com/tc39/ecma262/pull/1490, the "length" and "name"
properties of a class are defined before any static methods. This is
tested by #2057, in test/language/computed-property-names of all places.

At the same time, static methods with "name" as the name would overwrite
the original property, but retain the original property enumeration
order. This was not previously tested. In fact, the overwriting behavior
was not tested at all for the "length" property.

This commit mends both holes in test coverage.
2021-07-16 09:27:16 -04:00
jugglinmike afe217b318
Add tests for "Class Static Init. Blocks" proposal (#2968)
* Add tests for "Class Static Init. Blocks" proposal

This proposal is currently at "stage 3" in TC39's standardization
process.

* fixup! Add tests for "Class Static Init. Blocks" proposal

* Correct identifier reference

* Update tests for grammar

* Update tests for identifiers

* Add tests for scope derivation
2021-07-15 08:49:12 -04:00
Dan Clark 966c76617e
Add 'import-assertions' feature tag to json modules tests (#3016)
* Add 'import-assertions' feature tag to json modules tests

* Add a couple of others that I missed
2021-06-24 14:13:45 -04:00
Mike Pennisi 9b4ca4371b Add tests for change in Reference Records
These tests support the following normative change

"Normative: Allow null or undefined in Reference Records"
https://github.com/tc39/ecma262/pull/2267

The tests concerning the `delete` operator increase coverage to verify
behavior which, though related, is not altered by the normative change.
These tests are intended to guard against regressions as engines
implement the new semantics.
2021-06-24 13:16:43 -04:00
Mike Pennisi 93541f09e2 Test sequence during deletion of SuperProperty 2021-06-24 13:15:34 -04:00
Michael Dyck 52e7bfc4b6 "flags" is a top-level key, not a key within "negative" 2021-06-10 12:03:05 -04:00
Michael Dyck 675cad4aa3 Remove leading spaces from "---*/" line 2021-06-10 12:03:05 -04:00
Mike Pennisi e793512b55 Add tests for the "JSON modules" language proposal
https://github.com/tc39/proposal-json-modules

This proposal advanced to Stage 3 of TC39's standardization process on
2021-01-27.
2021-05-28 20:02:59 -04:00
Mike Pennisi d454b8389b Move some AnnexB tests per proposed spec change
Additionally, update test metadata and introduce two new tests to
complete coverage.

Reference: "Normative: Make B.1.{1,2} normative"
https://github.com/tc39/ecma262/pull/1867
2021-05-21 13:06:41 -04:00
jugglinmike 8183e9a629
Add test for TLA DFS invariant (#2989)
This behavior was introduced after the Top-Level Await proposal reached
stage 3: https://github.com/tc39/proposal-top-level-await/pull/159
2021-05-14 12:26:25 -04:00
Mike Pennisi 5ae04619a9 Generate tests 2021-05-14 11:04:29 -04:00
Mike Pennisi 18834b2e19 Add tests for import assertions 2021-05-14 11:04:29 -04:00
Mike Pennisi 9b622bf093 Remove or relocate misleading tests
These tests were designed to test the built-in "Promise.race Resolve
Element function," but ECMA262 does not describe such a function.

Contrary to the test's description, the function under test is created
by the InstantiateArrowFunctionExpression abstract operation. The
following tests verify most of the details directly (only the function
object's extensibility was not already tested by the existing tests):

- test/language/expressions/arrow-function/name.js
- test/language/expressions/arrow-function/throw-new.js
- test/language/expressions/arrow-function/prototype-rules.js

The definition of the built-in resolving functions is closely related,
but Test262 already includes tests for the corresponding concerns:

- test/built-ins/Promise/resolve-function-extensible.js
- test/built-ins/Promise/resolve-function-name.js
- test/built-ins/Promise/resolve-function-nonconstructor.js
- test/built-ins/Promise/resolve-function-prototype.js

Remove the tests and introduce one additional test to preserve coverage
while improving discoverability.
2021-05-11 17:36:28 -04:00
Stuart Cook 9da1d6119c
Add more tests for `for (async of` edge-cases (#2983) 2021-05-07 16:16:34 -04:00
Stuart Cook c11d6b00bc
Add a test for `for await (async of` (#2982) 2021-05-04 15:05:45 -04:00
Alexey Shvayka eca69e2c95 Test internal methods of module namespace objects with indices 2021-04-20 09:59:06 -04:00
Ross Kirsling 0f82225ccc Strengthen sloppy-mode tests for future reserved words. 2021-04-20 09:54:23 -04:00
Mike Pennisi 3addcc4b04 Generate tests 2021-04-20 09:53:57 -04:00
jugglinmike 61c6f8214b
Add tests for stage 3 proposal "private fields in" (#2963) 2021-04-19 07:50:52 -07:00
strager 6888a8df82
Fix typo in private getter/setter tests (#2971)
Several tests for getters and setters claim to check for an early
SyntaxError regarding mixing static and non-static propeties with the
same name. However, the tests trigger another issue: the getters have no
method body; they're missing curlies.

Fix the tests to test only the intended SyntaxError, not unrelated
SyntaxError-s.
2021-04-09 20:13:41 -04:00
Mike Pennisi aca79695ba Add coverage for `Yield` parameter in RHS of `in` 2021-03-06 12:28:45 -05:00
Alexey Shvayka c8daa32e48
Improve object rest/spread with Proxy coverage (#2930)
* Test object spread with Proxy

* Test object spread with non-enumerable keys and Proxy

* Test object rest with excluded keys and Proxy

* Test object rest with non-enumerable keys and Proxy
2021-02-26 16:59:51 -05:00
Gus Caplan 516ca9af39 Update tests for ECMA262 #2216
https://github.com/tc39/ecma262/pull/2216
2021-02-26 11:49:49 -05:00
jmdyck 11624af8d0
Update "info" field (#2941)
The quoted spec wording changed in ecma262#1694.
2021-01-28 16:03:01 -08:00
Caio Lima f81c2f5422 Adding test case for super access from class field defined as arrow function 2021-01-18 09:41:23 -05:00
Kevin Gibbons 96f1e2713b add tests for `for ( async of` 2021-01-18 09:40:36 -05:00
Alexey Shvayka 51666c5315 Improve coverage of mapped arguments' [[DefineOwnProperty]] method 2020-12-11 11:06:51 -05:00
Rick Waldron 8051f05354 Improved metadata 2020-11-18 16:44:55 -05:00
Rick Waldron fe5f8192de Fix typo 2020-11-18 16:44:55 -05:00
Rick Waldron b5ccbcb5e4 Coverage: Missing test for function length and parameter destructuring. Closes gh-2895 2020-11-18 16:44:55 -05:00
Rick Waldron 602c828805 Coverage: read-only function expression name. Closes gh-2896 2020-11-18 16:30:13 -05:00
Rick Waldron e1bfbbfdc8 Fix: Broken test: language/global-code/decl-lex-configurable-global.js. Closes gh-2897 2020-11-18 14:00:54 -05:00
Rick Waldron 1c33fdb0ca Test cases for invalid escape sequences preceding "use strict". Fixes gh-2893 2020-11-04 13:46:04 -05:00
Rick Waldron a563e3a3f8 Remove template that is generating duplicate tests 2020-10-29 13:48:50 -04:00
Rick Waldron d6b342338e arbitrary-module-namespace-names: Assertion correction. Fixes gh-2866 2020-10-19 17:47:40 -04:00
Rick Waldron 3439564fca Add "☿" export to export-expname_FIXTURE.js. Fixes gh-2866 2020-10-17 09:19:45 -04:00
Rick Waldron 23f30e527a Move $DONOTEVALUATE() calls to correct position 2020-10-16 20:37:40 -04:00
Rick Waldron 487b77eda8 Fix gh-2866 2020-10-16 20:34:32 -04:00
Shu-yu Guo f38e55def4 Add SyntaxError tests for string literal export name 2020-10-16 20:32:10 -04:00