Commit Graph

36 Commits

Author SHA1 Message Date
QuXing9 91a9abff4e
Add three testcases for test262 suite. (#2692)
* Add tests for escape function when parameter is not a string.

Fixes #2687
Fixes #2637

* Add test for indirect eval calls  when script is a for statement.

When for statement doesn't have a body, it should throw a SyntaxError.

Fixes #2661

* Add tests for Function Constructor when body contains usestrict.

Fixes #2688
Fixes #2638
2020-07-09 09:57:55 -07:00
Leo Balter 9338f22908 Add tests for direct eval calls in strict context
Fixes #2623
2020-05-20 13:31:27 -04:00
Ross Kirsling 815913a982 Test update for proposed Annex B.3.5 simplification 2019-01-30 09:57:50 -05:00
Rick Waldron f1e362d558 Fix typos; generate tests (#1907) 2018-10-26 17:11:05 -04:00
Thomas Wood 2d4ac25fa0 Add feature flags for `new.target`
Additionally removed the `arrow-function` feature for
test/language/eval-code/direct/new.target-fn.js as it is not testing
arrow-functions, but they are mentioned in the preamble.
2018-07-24 20:31:35 +01:00
André Bargull a1faccdd41 Fix various test bugs
- "CannotSuspendMainAgent" feature was changed to "CanBlockIsFalse" flag
- Move annex-b tests into annex-b directory
- Update variable names in nonshared-int-views.js tests
- Move getReport() call in nan-for-timeout.js to avoid iloop
- Update BigInt constructor to match new semantics (tc39/proposal-bigint#138)
2018-04-24 09:52:35 -07:00
Rick Waldron a1a4e2b1b8 Corrections to sec-web-compat-evaldeclarationinstantiation and sec-web-compat-functiondeclarationinstantiation tests. Fixes gh-1364 (#1509) 2018-04-18 16:54:30 -04:00
Rick Waldron 92a2621901 Frontmatter: fixup "info: >" to "info: |" 2018-01-05 12:27:59 -05:00
Leo Balter f8f5a7a1e7
Add missing generators flags 2017-10-26 19:04:57 -04:00
Leo Balter 7cbbe51216 Add cross-realm feature 2017-09-22 15:29:10 -04:00
Rick Waldron fdd2fa9b1c Rename $ => $262. Fixes gh-802 (#823)
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
2017-03-01 16:34:15 -05:00
jugglinmike 720c3cc8cc Update for new `eval` restrictions on `super` (#781)
A recent change to the specification [1] introduces parse-time errors
for certain usages of `super` within eval code. Modify all tests that
are affected by this change:

- Update the test bodies to accurately enforce the new semantics
- Rename files to better reflect the section of the specification that
  they enforce
- Update test meta-data
  - Change the `esid` meta-data to reflect the location of the relevant
    specification text
  - Remove the `es6id` meta-data as the behavior is no longer relatable
    to that specification
  - Introduce the `features` meta-data in cases where the test file's
    new location no longer reflects all required language features

[1] "Normative: Clarify rules around super inside eval"
    https://github.com/tc39/ecma262/pull/685
2016-10-24 10:43:44 -07:00
jugglinmike 71e573f7da Add tests for realm interactions (#688)
* Add tests for prototype realm inference

* Add tests for miscellaneous realm concerns

* Add tests for realm of spec-created Errors

In some cases, Error objects produced by the specification are
observable from ECMAScript code. Among these cases, some are further
differentiated in that they occur outside of any built-in function and
may be triggered through syntactic production directly. The current
realm record is commonly interpreted incorrectly under these
circumstances.

Add tests asserting that the expected realm record is used when
constructing such Error objects.

* Add tests for realm use in ArraySpeciesCreate

* Add tests for function realm retrieval

* Add tests for cross-realm behaviors of Symbols

* Add tests for GetValue and PutValue

* Add tests for realm of spec-created Arrays

In some cases, Arrays produced by CreateArrayFromList are observable
from ECMAScript code. Among these cases, two occur outside of any
built-in function and may be triggered through syntactic production
directly. The current realm record is commonly interpreted incorrectly
under these circumstances.

Add tests asserting that the expected realm record is used when
constructing arrays.

* Add test for spec-created object

* fixup! Add tests for realm of spec-created Errors

* fixup! Add tests for realm of spec-created Errors

* fixup! Add tests for prototype realm inference

* fixup! Add tests for miscellaneous realm concerns
2016-10-24 10:43:17 -07:00
Mike Pennisi 7d4b1d28ae Re-format tests for SyntaxErrors
Authored via the following command:

   $ find test -type f -print0 | \
       xargs -0 sed \
         -i 's/^\(\s*\)negative:\s*SyntaxError\s*$/\1negative:\n\1  phase: early\n\1  type: SyntaxError/g'
2016-10-19 15:24:21 -04:00
Mike Pennisi 203b234fc0 Reformat negative SyntaxError tests (runtime)
These tests specifically concern error produced from the global scope,
precluding the use of the `assert.throws` helper function.
2016-10-19 15:24:18 -04:00
Mike Pennisi 24391fb9e8 Add tests for early errors from `super` 2016-07-02 15:46:15 -04:00
jugglinmike e290a337b8 Improve coverage for section 12, "Expression" (#695)
* Add missing test for early error

* Add missing test for WithBaseObject

* Improve coverage for `new.target`

* Add test for deletion of SuperReference

* Add tests for `in` keyword restrictions

* fixup! Improve coverage for `new.target`
2016-07-01 11:23:43 -07:00
Leo Balter 1e75730d5f Merge pull request #587 from bocoup/generation-annexb-fns
Add tests for Annex B "function in block" semantics (procedurally generated)
2016-05-31 17:45:48 -04:00
Mike Pennisi 784824895d Extend coverage for eval code
Closes #572

Introduce tests for new semantics for ES2015 features such as
lexically-scoped bindings. Also add tests for semantics defined in prior
editions of the specification but not yet covered in this test suite.
2016-04-25 16:43:48 -04:00
Mike Pennisi 2872537136 Add equivalent tests for eval code
For each test that asserts the behavior of either "direct" or "indirect"
eval (but not both), introduce an equivalent test for the opposite case.
2016-04-25 16:36:41 -04:00
Mike Pennisi 364d6433e2 Refactor tests for eval code
Some tests asserted behavior for both "direct" eval and "indirect" eval.
Split these assertions across files dedicated for each use case.
2016-04-25 16:36:39 -04:00
Mike Pennisi 7630e1763d Re-organize tests for eval
Limit tests in `language/expressions/call/` and `built-ins/eval/` to
only assert details that are directly related to the invocation pattern.
Re-organize all other tests within the `language/eval-code/` directory,
further categorizing each as `direct` or `indirect` as appropriate.
Remove the extraneous "executable" flag from those files which carried
it.
2016-04-25 16:36:36 -04:00
jugglinmike 38329a7038 Add tests for TryStatement binding restrictions (#577)
This changeset includes tests for early errors and those generated
dynamically by eval. It also accounts for relevant AnnexB extensions.
2016-04-21 15:54:25 -04:00
Mike Pennisi 4766365dc6 Add tests for Annex B.3.3/B.3.4
These tests ensure that the annex B extensions for function declarations
are *not* observed in strict mode code.
2016-04-18 16:18:54 -04:00
jugglinmike a068f19f06 Streamline redundant `eval` tests (#570)
Some tests for `eval` assert the equality of key enumeration on the
global object, comparing the ordering when the object is referenced
through eval.

Based on the test bodies and the "info" field in their metadata, these
tests appear to have been written under the mistaken impression that
erroneous creation of an environment record would be observable through
the `this` value.

In reality, the value in such cases resolves to the global object. That
renders these tests redundant and overly complex--none of the
distinctions between each test actually demonstrates a different
behavior.

Remove the redundant tests and introduce three new tests asserting the
correct resolution of the `this` keyword for direct eval code from
within the global scope and from within function scope.
2016-04-18 13:35:03 -04:00
Mike Pennisi 63c1cd3da8 Update meta data: `id` to `esid`
The project's expected frontmatter tag name changed while these files
were under review.
2016-03-10 19:46:46 -05:00
Mike Pennisi a6dcd0dcca Add tests for position of module declarations
Assert that ImportDeclaration and ExportDeclaration match only the
ModuleItem symbol.

According to the definition of HostResolveImportedModule, it is
acceptable for an implementation to throw a SyntaxError in the event
that a requested module can neither be found nor created:

> If a Module Record corresponding to the pair referencingModule,
> specifier does not exist or cannot be created, an exception must be
> thrown.

In order to reliably detect a SyntaxError in response to the correct
interpretation of the grammar (and not a SyntaxError from an *incorrect*
interpretation of the grammar followed by a failure to resolve the
requested module), the ModuleSpecifier of ExportDeclarations should
describe a valid resource.
2016-02-19 17:36:17 -05:00
André Bargull b62dccf1dc Add test cases for recent ES2016 fixes
- lastIndex in RegExp.prototype[Symbol.split]: tc39/ecma262@08b4756747
- Missing number conversion in DataView.prototype.setXXX: tc39/ecma262@4f875fe96d
- Negative zero byteoffset in TypedArray: tc39/ecma262@2d1ed20db7
- EvalDeclarationInstantiation throws TypeError: tc39/ecma262@2be6968715
- BindingRestElement allows BindingPattern: tc39/ecma262@d322357e6b
- Eval in parameters with computed property keys: tc39/ecma262@04e2e9b719
- Use strict with non-simple parameters: tc39/ecma262@15b0db41ed
- __proto__ in strict mode: tc39/ecma262@5c1984334d
2015-12-15 17:33:49 +01:00
André Bargull ba1b02a047 Replace runTestCase with assert helpers [test/language/eval-code] 2015-08-13 17:32:19 +02:00
André Bargull a85f5039e0 Remove links to hg.ecmascript.org 2015-07-17 17:43:09 +02:00
Mike Pennisi 10e0d977ec Prefer explicit error checking where possible
The `negative` frontmatter tag expresses an expectation for the behavior
of the test file as a whole. The `assert.throws` helper function offers
more fine-grained control over expectations because it may be applied to
specific statements and expressions. This makes it preferable in cases
where it may be used (i.e. when the test body does not describe a syntax
error or early error).

Re-implement assertions for errors to use the `assert.throws` helper
function wherever possible.
2015-07-10 14:12:57 -04:00
Mike Pennisi 29ecced632 Update handling of directive prologues
Some tests specifically concern the application of the `use strict`
directive as it appears in JavaScript source code. These tests should
*not* be run with the `onlyStrict` flag because relying on the test
runner to enable strict mode makes the semantics of the source code
irrelevant. Update these tests to use the `noStrict` flag.

Other tests concern language semantics that are only valid in strict
mode, but the mechanism for enabling strictness is inconseqential.
Update these tests to use the `onlyStrict` flag and remove any redundant
`use strict` directive prologues contained within.

Still other tests are valid both within and outside of strict mode.
In keeping with the majority of other tests, do not specify any
restrictions on the environments in which these tests may be run.
2015-06-18 17:38:34 -04:00
Mike Pennisi ef1fddd533 Fix invalid tests 2015-06-18 17:38:33 -04:00
Pieter van Ginkel 6883892d32 Add tests for variable instantiation for eval in strict mode
Test case 10.4.2-3-c-2-s verifies that eval can't instantiate variables in the calling context. However, it does not verify that the variable isn't matched to the global context either. Added test case 10.4.2-3-c-3-s to check for this.
2015-05-30 09:24:33 +02:00
André Bargull 89a4bb5ae4 Fix strict mode errors in language
- Add missing "var" declarations and noStrict flags
- Add strict mode tests for:
 - arguments-object/10.6-6-3 -> arguments-object/10.6-6-3-s
 - arguments-object/10.6-6-4 -> arguments-object/10.6-6-4-s
- Remove try-finally clean-up code
- Add strict mode compatible tests for eval-code/S10.4.2_A1.1_T*
  - No strict mode compatible files added for eval-code/S10.4.2_A1.2_T*, because it doesn't really make sense in this context.
  - (S10.4.2_A1.1 and S10.4.2_A1.2 should probably be removed, because the tested behaviour is not required by the spec.)
- Split S8.5_A10, S8.5_A4 and S8.1_A3 into declaration (both modes) and assignment tests (non-strict only)

Part of issue #35.
2015-05-08 17:27:52 +02:00
Brian Terlson 2a74f0ec1b Reorganize ./test 2014-12-07 15:33:09 -08:00