Commit Graph

1355 Commits

Author SHA1 Message Date
Kevin Gibbons 746197355c
Implement changes for "avoid mostly-redundant `await` in async `yield*`" (#3619) 2022-09-06 13:21:50 +02:00
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