1451 Commits

Author SHA1 Message Date
Ross Kirsling
609614febe
Add tests for "Runtime Errors for Function Call Assignment Targets" (#4459)
* Add tests for ecma262#3568

* "Late" -> "Runtime"

* Check for functions named `async` too.
2025-07-15 09:22:15 -07:00
André Bargull
5920cb8e1b Add coverage for IteratorClose throw-completion forwarding in destructuring contexts
SM doesn't pass these tests.
2025-06-03 10:41:41 +02:00
Ron Buckton
419d85ad21
[explicit-resource-management] Add remaining tests specific to using in for-of and for-await-of syntax (#4484) 2025-05-21 13:45:41 -07:00
Nicolò Ribaudo
bcdafc269f
Increase coverage for dynamic import and top-level await (#4421) 2025-05-08 16:55:49 +02:00
Nicolò Ribaudo
eeacc18d05 Fix import defer test bugs 2025-04-23 10:55:52 -07:00
Andreu Botella
c5257e6119
Test that string comparison is per-code-unit (#4457) 2025-04-18 11:57:19 +02:00
Philip Chimento
84f820258b harness: Remove hidden-constructors harness file
The objects it provides are also available in another harness file,
wellKnownIntrinsicObjects.js. There's no point in duplicating that in the
harness. Rewrite each test that used hidden-constructors.js to use
getWellKnownIntrinsicObject instead.
2025-03-11 18:14:55 -07:00
Nicolò Ribaudo
2ad7f321d7 Rewrite import defer resolution test ot not expect specific error 2025-02-27 16:08:00 +01:00
Linus Groh
88ebb1e375 Avoid relative imports outside of test directory 2025-02-26 16:39:22 +01:00
Chengzhong Wu
74788df072
Remove source phase resolution time negative error types (#4194) 2025-02-18 16:11:31 +01:00
Nicolò Ribaudo
bc5c14176e
Add evaluation tests for import.defer with sync/async modules (#4375)
* Add evaluation tests for `import.defer` with sync/async modules

* Remove accidental import declaration
2025-02-04 11:43:57 -08:00
Nicolò Ribaudo
573058ed2e
Add syntax tests for import.defer (#4374)
These tests are all based on the existing dynamic import syntax tests, just updated to use the new syntax.

This PR does not contain any manually written tests -- they are all generated.
2025-02-04 11:38:19 -08:00
Boshen
d8e2cb2741 Update missed bracket in module-self-import-async-resolution-ticks.js 2025-01-31 08:47:52 -08:00
Nicolò Ribaudo
e7a84b0a09
Update import defer tests for evaluation triggers (#4341) 2025-01-24 10:54:39 +01:00
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