Commit Graph

1437 Commits

Author SHA1 Message Date
Asumu Takikawa 1d7a2938a2 Fix two minor errors for import-defer tests
* assert.deepEqual is used in one but without the include
  * typo of assert in the other
2025-01-06 17:51:47 +01:00
Nicolò Ribaudo f8231fcdda
Add test for @@toStringTag on deferred module namespaces (#4360)
Co-authored-by: Linus Groh <mail@linusgroh.de>
2024-12-18 15:20:07 +00:00
André Bargull 98a7f03f5c Remove leading space characters in YAML frontmatter
Remove leading space characters so directly loading the frontmatter text
with `yaml.safe_load` doesn't throw an exception.
2024-12-17 17:52:36 +01:00
Nicolò Ribaudo 36687a502c
Fix the `phase` in tests about invalid JSON module bindings (#4348) 2024-12-17 14:56:48 +00:00
Nicolò Ribaudo dad2774b2e
Add missing `from` in two `import defer` tests (#4338) 2024-12-07 12:42:54 +01:00
Nicolò Ribaudo 10c2615aa5
Add partial tests for `import defer` (#4278)
Co-authored-by: Asumu Takikawa <asumu@igalia.com>
2024-12-02 10:32:38 +01:00
Théo LUDWIG 01776c30d3 test(top-level-await): move out of staging module graphs hanging 2024-10-29 19:35:56 +01:00
Chengzhong Wu 3f0a24f4f6 [source-phase-imports] update missing source error type 2024-10-25 11:37:04 +02:00
_Kerman 0add42b556
fix: heritage-arrow-function.js (#4273) 2024-10-21 15:54:30 +02:00
Ron Buckton dc7a22dd28 Function branding boilerplate tests from PR #3866 2024-09-20 10:48:23 -07:00
André Bargull 18ae34d8f2 Improve coverage for reference type in various contexts
Missing coverage encountered while implementing
<https://github.com/tc39/ecma262/pull/3307> in SpiderMonkey.

Ensure environment lookups are performed in the correct order:
- keyed-destructuring-property-reference-target-evaluation-order-with-bindings.js

Ensure `delete super[elem]` steps are correctly performed:
- delete/super-property-topropertykey.js
- delete/super-property-uninitialized-this.js

Ensure ToPropertyKey for computed property names in object literals
correctly performed:
- object/computed-property-name-topropertykey-before-value-evaluation.js

Ensure `GetSuperBase` is executed before `ToPropertKey`:
- super/prop-expr-getsuperbase-before-topropertykey-*

Ensure `GetThisBinding` is executed first:
- super/prop-expr-uninitialized-this-*
2024-09-20 16:00:53 +02:00
André Bargull 867ca540d6 Add test coverage for correct binding object MOP executions in with-environment 2024-09-13 12:28:45 -07:00
Mathias Bynens 83c58c5055 Move updated `unicodeSets` tests to their appropriate location 2024-09-13 14:38:51 +02:00
Mathias Bynens 4bdf978220 Add tests for Unicode v16 Identifier{Start,Part}
Issue: https://github.com/tc39/ecma262/issues/3425

.
2024-09-12 08:48:21 -07:00
Paul Bakker 98c7e9114e
Test computed accessor properties and AggregateError constructor without arguments (#4222) 2024-09-11 11:41:07 +02:00
Aapo Alasuutari cff5a6012f
fix: Use Object.getPrototypeOf to get prototype in `__proto__-fn-name.js` (#4205) 2024-09-09 14:37:00 +02:00
Ioanna M Dimitriou H fc49c9ce16
Move function MayNeedBigInt to RAB helper file and inline WriteToTypedArray. (#4211) 2024-09-03 16:23:23 +02:00
Nicolò Ribaudo d012a4d0ef
Add test for asi between `get`/`set` field and generator (#4189)
Co-authored-by: André Bargull <andre.bargull@gmail.com>
Co-authored-by: Linus Groh <mail@linusgroh.de>
2024-09-02 17:39:12 +02:00
Ioanna M Dimitriou H 3acb672d11
RAB: Integrate helper to rest of the tests (#4198)
Co-authored-by: Philip Chimento <philip.chimento@gmail.com>
2024-08-27 17:18:44 +02:00
André Bargull 18c8c85746 Add more tests for deleted bindings in object environments 2024-08-27 15:24:28 +02:00
Jonatan Klemets 3b4d9f53b5 Remove README about keeping import-assertions tests in sync 2024-08-22 12:19:08 -07:00
Jonatan Klemets 3b56bf655f Remove generated import-assertions test files
Generated by running `./make.py clean` and `./make.py`
2024-08-22 12:19:08 -07:00
Jonatan Klemets cfd81e1698 Remove import-assertions test files 2024-08-22 12:19:08 -07:00
Richard Gibson b70b75793d Test `await` in ConditionalExpression 2024-08-21 10:19:55 +02:00
Peter Hoddie e4f4abdcb2
Compatibility with Hardened JavaScript (#4088)
This PR proposes changes to existing test262 tests to allow them to pass under Hardened JavaScript (see Secure ECMAScript proposal and Hardened JavaScript). Moddable uses Hardened JavaScript for JavaScript runtimes on resource constrained embedded devices, including those targeted by ECMA-419.

The changes fall into four groups:

1. Replace use of new Date() with new Date(1970). Scripts running inside a Compartment cannot retrieve the current time, so new Date() throws but new Date(1970) succeeds. Very few tests need the current time, but instead simply need a Date instance.
2. Use Object.defineProperty instead of setting existing built-in properties directly, such as toString and toValue. In Hardened JavaScript, prototypes of built-in objects are frozen. Consequently, setting properties of an instance that exist on the prototype throw (Hardened JavaScript is always in strict mode).
3. Eliminate use of Math.random(). Scripts running inside a Compartment cannot generate random numbers. One test identified so far uses Math.random() in a way that can easily be replaced with a counter.
4. Narrow the scope of exception tests. Consider the following

assert.throws(TypeError, () => {
  var s1 = new Date();
  s1.toString = Boolean.prototype.toString;
  s1.toString();
});

This test passes, but only because new Date() fails by throwing a TypeError. If the invocation of the Date constructor is resolved by (1) above, then the assignment to toString fails as per (2) above. The script should be modified as below to ensure that assert.throws only tests the intended statement, s1.toString(). The modified script tests the intended functionality and passes under Hardened JavaScript

var s1 = new Date(1970);
Object.defineProperty(s1, "toString", {
  value: Boolean.prototype.toString
});
assert.throws(TypeError, () => {
  s1.toString();
});

This is an initial PR to begin the process of adapting test262 for use with Hardened JavaScript. Further changes are expected, with the vast majority likely to fall into the four groups described above.

Thank you to gibson042, kriskowal, and erights for their advice on this work.
2024-07-04 08:19:23 -07:00
Linus Groh a82f5382ff Remove 'AsyncArrowFunction' test
There is no such hidden constructor, it's the same as the hidden
AsyncFunction constructor. In other words:

```js
Object.getPrototypeOf(async () => {}).constructor ===
Object.getPrototypeOf(async function () {}).constructor
```

Also add a test to ensure that %AsyncFunction.prototype% is indeed the
prototype of an async arrow function.

Closes #4044.
2024-07-04 11:03:23 +02:00
Nicolò Ribaudo 03852c962b
Avoid duplicate binding import-source-binding-name.js (#4121) 2024-06-28 15:14:23 +02:00
Chengzhong Wu 8a2229cde8
Add tests for Source Phase Imports (#3980) 2024-06-27 14:58:04 +02:00
Linus Groh cdf7ba7396 Fix typo in with statement test file name 2024-04-29 15:30:25 +02:00
Ross Kirsling 007b333af2 Add additional tests for tc39/ecma262#3307.
Ensure that the following cases are covered:
- https://github.com/tc39/ecma262/issues/3295#issuecomment-2058110314
- https://github.com/tc39/ecma262/issues/2659#issue-1131245695
2024-04-22 12:36:07 -07:00
Marko Lahma 263c514afa Add missing DummyError function definition to target-super-computed-reference.js 2024-04-15 11:30:42 -07:00
Ross Kirsling 142a6a6fbe
Update test for o[p] = f() (#4052)
* Update test for o[p] = f()

Update S11.13.1_A7_T3.js now that consensus has been reached on https://github.com/tc39/ecma262/pull/3307.

* Rename test and add an analogous one for super.
2024-04-12 11:59:40 -07:00
Shu-yu Guo c5a80993cd Allow global var-via-eval be declared
See https://github.com/tc39/ecma262/pull/3226
2024-04-11 17:22:43 -07:00
Ioanna M. Dimitriou H 9e03c403e7 Test parsing error when using unicode escape sequences to express i, m, s
As suggested in https://github.com/tc39/test262/pull/3960#issuecomment-1966827213
2024-03-05 12:56:48 -08:00
Guillaume Emont 229a27bcbc Added new generated tests with uppercase I
Co-Authored-By: Ioanna M. Dimitriou H <idimitriou@igalia.com>
2024-03-05 12:56:48 -08:00
Cam Tenny 49a58a4716 Adds syntax tests for the RegExp modifiers proposal
Based on PR #3807 which had generated these tests from templates,
but was stuck due to issue #3808.

Co-Authored-By: Guillaume Emont <guijemont@igalia.com>
Co-Authored-By: Ioanna M. Dimitriou H <idimitriou@igalia.com>
2024-03-05 12:56:48 -08:00
Nicolò Ribaudo c0e8eef81b
Add test for async module not blocking sync siblings (#3955) 2024-02-21 14:53:10 +01:00
Lucas Mirelmann 403ee414ab
Fix comment in allow-nlt-before-with.js (#4001)
The proposed syntax allows a line terminator before the `WithClause`.
2024-02-09 16:36:41 -08:00
Nicolò Ribaudo bebce4a5ee Make sure that the test always throws a SyntaxError 2024-01-15 15:16:53 -08:00
Nicolò Ribaudo 8b1bd25b49 Do not expect specific error type in import-attributes/allow-nlt-before-with.js
Hosts are free to throw whatever error they want during module loading: there is no guarantee that the error thrown due to the import with `type: "foo"` is a SyntaxError.
2024-01-15 15:16:53 -08:00
Kevin Gibbons 67a5153cf5
add Float16Array to all generic TypedArray tests (#3849) 2024-01-10 14:07:57 +01:00
Kevin Gibbons 5a263f5b19 add the TypedArray feature flag to some tests which were missing it 2024-01-08 17:21:46 -08:00
Michael Dyck 816b6b14d8 Delete trailing space from "info: |" lines 2024-01-08 16:04:41 +01:00
Richard Gibson 2060494f28 Test for assignment with target wrapped in two sets of parentheses 2023-11-21 09:51:03 -05:00
Veera c1281dba45 Test for Unicode Escape in Literals 2023-10-31 16:57:41 -07:00
Nicolò Ribaudo 0a6dabf1e2 Add readmes 2023-10-26 18:21:19 -07:00
Nicolò Ribaudo 41515e87e5 Use import-attributes flag in new generated tests 2023-10-26 18:21:19 -07:00
Nicolò Ribaudo 3ddb9e5e95 Update import attributes tests to use the `with` keyword 2023-10-26 18:21:19 -07:00
Nicolò Ribaudo 06f6ae960a Copy all import assertions tests as a basis for import attributes tests 2023-10-26 18:21:19 -07:00
Daniel Minor 55e8cceb80 Revert "Revert "Fixup class names in class decorator private identifier tests.""
This reverts commit 31f703cbe69ec2e0fd4b94de2fdf505fb722b552.

The changes are needed to both the templates and the generated files.
2023-10-05 10:23:12 -07:00