Commit Graph

304 Commits

Author SHA1 Message Date
Mike Pennisi d4b263ccbb Generate tests 2016-05-10 11:57:37 -04:00
Mike Pennisi 43bce311db Add tests for Annex B extns to RegExp patterns
Remove previously-existing tests in favor of new versions that are more
complete and more appropriately named.
2016-05-10 10:38:04 -04:00
jugglinmike f7a61edc6f Add tests for Annex B extns to numeric literals (#608) 2016-05-09 18:31:23 -04:00
jugglinmike db8ff7cc01 Add tests for Annex B extns to comments (#612) 2016-05-09 18:29:18 -04:00
Ian Halliday 022888be9e Remove duplicate front matter keys (#621)
Fixes #620
2016-05-06 13:41:33 -04:00
jugglinmike aebf3d63bc Add tests for Annex B extns to string literals (#610)
This change set does not include a test for restrictions relating to
template literals because such a test already exists in the project.

While a form of this test for string literals in strict mode code
existed previously, it is less precise and relies on unrelated
semantics. Remove the previous form and replace with a more direct
version.
2016-05-06 11:19:09 -04:00
Gorkem Yakin 832365f9c2 Merge pull request #565 from bocoup/modules-namespace
Add tests for module namespace objects
2016-04-29 14:26:05 -07:00
Gorkem Yakin 583a83c202 Merge pull request #563 from bocoup/modules-eval
Module semantics: evaluation
2016-04-29 14:26:01 -07:00
Gorkem Yakin d5c92d09f0 Merge pull request #562 from bocoup/modules-instn
Module semantics: declaration instantiation
2016-04-29 14:25:54 -07:00
Gorkem Yakin a58ca88b31 Merge pull request #561 from bocoup/modules-early
Module code: early errors
2016-04-29 14:25:49 -07:00
Gorkem Yakin f50cc81ace Merge pull request #560 from bocoup/modules-syntax
Module code: syntax validation
2016-04-29 14:25:43 -07:00
Mike Pennisi 73a7e23061 Re-generate tests 2016-04-26 16:13:32 -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
Gorkem Yakin 7f88f29328 Merge branch 'bocoup/global-object' 2016-04-25 11:09:49 -07:00
Mike Pennisi eb644bb2da Reduce reliance on `fnGlobalObject.js`
This harness function is not necessary in the majority of cases in which
it is used. Remove its usage to simplify tests and decrease the amount
of domain-specific knowledge necessary to contribute to the test suite.

Persist the harness function itself for use by future tests for ES2015
modules (such a helper is necessary for tests that are interpreted as
module code).
2016-04-25 11:09:21 -07:00
Mike Pennisi 3d68fcc063 Increase coverage for Symbol constructor
Add new tests for invocation requirements; re-organize existing files
according to the language feature under test.
2016-04-25 10:59:22 -07:00
Mike Pennisi a8401b34d8 fixup! Add tests for module namespace objects
Implement suggested modification to naming scheme.
2016-04-22 16:36:06 -04:00
Mike Pennisi 436ad9cdfd fixup! Module semantics: evaluation
Implement suggested modification to naming scheme.
2016-04-22 16:29:26 -04:00
Mike Pennisi 84438a53d0 fixup! Module semantics: declaration instantiation
Implement suggested modification to naming scheme.
2016-04-22 16:21:57 -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 f7aa31b41f Remove over-specified tests
Except for a small set of expected input/output pairs, both ES5 and
ES2015 define the expected return value of these methods in terms of an
"implementation-dependent approximation." This makes it inappropriate to
enforce expectations for specific values, even if expressed imprecisely.
2016-04-18 14:36:49 -04:00
jugglinmike 26676beab5 Add tests for IteratorClose in dstr assignment (#524)
The files in this patch are organized according to the following naming
scheme:

Prefix             | Grammar production
-------------------|-------------------
`array-empty-`     | ArrayAssignmentPattern : [ ]
`array-elision-`   | ArrayAssignmentPattern : [ Elision ]
`array-rest-`      | ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
`array-elem-`      | ArrayAssignmentPattern : [ AssignmentElementList ]
`array-elem-trlg-` | ArrayAssignmentPattern : [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]

Suffix             | Intent
-------------------|-------
`-abpt-close-err`  | The assignment evaluation returns an abrupt completion, and the iterator's `return` method throws an error
`-abpt-close-skip` | The assignment evaluation returns an abrupt completion, but IteratorClose is not invoked
`-abpt-close`      | The assignment evaluation returns an abrupt completion, and IteratorClose is invoked as specified
`-get-err`         | Abrupt completion returned from GetIterator
`-nrml-close-err`  | The assignment evaluation completes, and the iterator's `return` method throws an error
`-nrml-close-null` | The assignment evaluation completes, and the iterator's `return` method returns a non-Object value (there is no corresponding `-abpt-` suffix because the algorithm does not reference the return value in those cases)
`-nrml-close-skip` | The assignment evaluation completes, but IteratorClose is not invoked
`-nrml-close`      | The assignment evaluation completes, and IteratorClose is invoked as specified

Not all suffixes are appropriate for all productions. Suffixes have been
simplified in cases where less specificity is necessary to disambiguate
test cases.
2016-04-18 14:33:21 -04:00
jugglinmike c230b7f307 Add tests for RegExp literal early errors (#566) 2016-04-18 13:36:43 -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
Leo Balter 3723e7caeb Merge pull request #545 from bocoup/generation
Introduce test generation tool
2016-04-15 17:56:36 -04:00
Mike Pennisi e4c062c0eb fixup! Add tests for module namespace objects 2016-04-01 15:42:29 -04:00
Mike Pennisi 3dc6d92970 Add tests for module namespace objects
Assert correct behavior of the own properties of module namespace
objects and the essential internal methods of module namespace exotic
objects.
2016-04-01 13:15:16 -04:00
Mike Pennisi cfd7e1f61d Module code: early errors
Assert that relevant early errors are reported following the parsing of
module code.
2016-03-29 12:55:16 -04:00
Mike Pennisi 91e4e20084 Module semantics: evaluation
Files whose name ends in `_.js` are not themselves valid Test262 tests
and should not be interpreted as such by test runners.

---

The tests for the GetBindingValue method of the module Environment
Record are very minimal. This is because GetBindingValue is necessary to
assert any aspect of binding creation/initialization/mutation. In this
way, GetBindingValue is being implicitly tested by every test that
references a binding value.
2016-03-29 12:38:02 -04:00
Mike Pennisi 4273ad1fa7 Module semantics: declaration instantiation
Files whose name ends in `_.js` are not themselves valid Test262 tests
and should not be interpreted as such by test runners.

---

Because the tests in this patch concern declaration *instantiation*,
care has been taken to avoid asserting binding values following
evaluation. Because a given module's dependencies are evaluated prior to
the module itself, this is only observable in modules which import their
own bindings.

A separate patch dedicated to the evaluation of module code asserts the
behavior of bindings following evaluation.

---

For tests that concern the creation of a module namespace object, this
patch relies on the semantics of the `in` operator. The `in` operator
uses the [[HasProperty]] internal method and avoids testing unrelated
semantics concerning binding resolution. Those semantics should be
explicitly asserted with a separate set of tests dedicated to that
purpose.

---

One test case which is notably missing is error resulting from a cycle
due to an `import` declaration (under the current file naming scheme,
such a test might be named `instn-named-err-circular.js`). Due to the
recursive nature of ModuleDeclarationInstantiation, it is not
technically possible for a circular request to be found in step 12.c.i.
Cycles rely on at least 2 `export` declarations, and because these are
resolved *before* imports, any cycle would trigger failure prior to step
12.c.

---

One aspect of *module* resolution that makes ordering observable is the
fact that resolution can fail in two distinct ways (i.e. with a
SyntaxError or with a ReferenceError). This patch includes tests that
leverage this detail in order to assert that modules are resolved in the
correct sequence.

However, from the perspective of the ECMA-262 specification, the
ordering of *export* (e.g. binding) resolution is not observable. This
is due to restrictions on the grammar, where each export is independent.
When *export* resolution fails, it does so with instances of SyntaxError
alone, precluding the above strategy.

So while ModuleDeclarationInstantiation resolves the exports of the
module's dependencies in the following order:

1. "Indirect" exports, e.g.
   - `export { x } from './y.js';`
   - `export { x as z } from './y.js';`
   - `import { x } from './y.js'; export { x };`
2. "Star" imports
   - `import * as ns from './y.js';`
3. "Named" (my word) imports
   - `import x from './y.js';`
   - `import { x } from './y.js';`
   - `import { x as z } from './y.js';`

Intentional failures cannot be used to discern resolution ordering.
2016-03-29 12:33:42 -04:00
Mike Pennisi f817f10858 Module code: syntax validation
Assert that module code is parsed as specified.
2016-03-29 12:10:49 -04:00
Mike Pennisi 076480fc2d Module code: Rename tests for early errors 2016-03-29 12:00:55 -04:00
Mike Pennisi 355ba1ba83 Module code: Remove redundant test 2016-03-29 12:00:28 -04:00
Mike Pennisi e858f918da Module code: Rename negative parsing tests 2016-03-29 12:00:25 -04:00
Leo Balter ba26b7f2dc Merge pull request #541 from bocoup/statement-decl
Add syntax tests for declaration restrictions
2016-03-18 15:48:44 -04:00
Leo Balter 5b06fab039 Merge pull request #531 from bocoup/debugger
Add tests for `debugger` statement
2016-03-17 17:29:59 -04:00
Leo Balter 86ff467767 Merge pull request #525 from anba/throw-type-error
Improve coverage %ThrowTypeError% and default class constructors
2016-03-17 16:31:37 -04:00
Mike Pennisi 74bff6b3d5 Add initial set of generated test sources 2016-03-16 15:29:30 -04:00
Mike Pennisi 021ed85d97 Add syntax tests for declaration restrictions
Assert that declarations are not permitted in positions reserved for
statements only.
2016-03-11 12:23:15 -05: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 4f5a8674c2 Add tests for `debugger` statement
The runtime semantics of this statement are host-defined and therefore
untestable, but the statement's affect on the formal grammar should be
consistent across all implementations.
2016-03-09 11:12:56 -05:00
Dan Ehrenberg 007d3b1eb7 Remove a blank line to stop confusing YAML parsers
V8 ran into an issue where the YAML parser our test setup is using
didn't understand the newline, and failed to parser the negative
test expectation below, causing the test to fail. This patch fixes
the issue.
2016-03-04 15:01:01 -05:00
André Bargull 2acbd3e98e Improve coverage for default class constructors 2016-03-01 19:15:21 +01:00
Gorkem Yakin 5a77ac86a9 Merge branch 'bocoup/for-restrictions' 2016-02-25 14:22:09 -08:00
Mike Pennisi 4dd2d9b7ee Add tests for IterationStatement early errors 2016-02-25 14:21:08 -08:00
Gorkem Yakin b35b39c4aa Merge branch 'bocoup/module-code' 2016-02-25 13:51:47 -08:00
Gorkem Yakin 304dbf0569 Merge 'rwaldron/exponentiation-operator' 2016-02-23 14:25:05 -08:00