Commit Graph

106 Commits

Author SHA1 Message Date
Mike Pennisi e01a560648 Remove superfluous code from negative syntax tests
Because these files contain syntax errors, the code they contain is not
intended to be executed, and the runtime semantics are therefore
irrelevant. Simplify the files by removing the unnecessary code.
2018-04-27 22:04:23 -04:00
Yusuke Suzuki 18c1e799a0 Prefer spaces to tabs if it is not syntax related tests
This patch changes tabs to spaces for newly added tests.
2018-02-08 13:32:42 -05:00
André Bargull cbe12a53e1 Remove duplicate esids 2018-01-25 13:59:37 -05:00
Rick Waldron bbf3301ff4 Fix: es6id -> esid sec-html-like-comments 2018-01-10 16:01:21 -05:00
Mike Pennisi e6d674ef7a Rename negative test "phase" for module resolution 2018-01-05 15:17:51 -05:00
Mike Pennisi 136110378b Rename negative test "phase" for parsing
Early errors may result from parsing the source text of a test file, but
they may also result from parsing some other source text as referenced
through the ES2015 module syntax. The latter form of early error is not
necessarily detectable by ECMAScript parsers, however. Because of this,
the label "early" is not sufficiently precise for all Test262 consumers
to correctly interpret all tests.

Update the "phase" name of "early" to "parse" for all those negative
tests that describe errors resulting from parsing of the file's source
text directly. A forthcoming commit will update the remaining tests to
use a "phase" name that is more specific to module resolution.
2018-01-05 15:17:50 -05:00
Rick Waldron 92a2621901 Frontmatter: fixup "info: >" to "info: |" 2018-01-05 12:27:59 -05:00
Rick Waldron a801bdf786 Fix frontmatter 2017-12-19 15:42:57 -05:00
André Bargull 3ce00cf5e3 Add tests for uninitialized bindings when accessed through Object methods and for-in 2017-12-19 15:42:56 -05:00
Leo Balter a488271931
Update class fields tags in non-generated test files 2017-11-28 12:59:27 -05:00
Leo Balter 076ecc38c6
Fix bugs reported in #1338 (#1339)
* Accessing `ta[0]` throws a TypeError.

* Fix array indices starting at 0 and property references

* Fix classfields templates for properly checking static propnames.

* Generate tests

* `assert.equal` is not defined

* Add missing includes

* Generate tests

* typo s/Avalue/42/

* fix whitespace

* Add missing var for strict mode

* Expand generated class fields tests for forbidden computed property name values

Ref https://github.com/tc39/test262/pull/1339#issuecomment-342830243

* derived classes have access to private names in base classes, if private names are in scope
2017-11-10 15:06:00 -05:00
Valerie R Young 7572c0c36b Classfields: simple success case for nested classes private name reference 2017-10-29 20:46:09 -04:00
Valerie R Young 54f4d02aa6 Classfields: simple early errors test for privatename references in scripts 2017-10-29 20:46:09 -04:00
Leo Balter f8f5a7a1e7
Add missing generators flags 2017-10-26 19:04:57 -04:00
Leo Balter 2bee5df77a Add missing Symbol.iterator feature flags 2017-09-08 10:13:50 -04:00
Georg Neis fd5054f463 Relax [[DefineOwnProperty]] on module namespace exotic objects.
See https://github.com/tc39/ecma262/pull/858.
2017-08-07 10:50:02 -04:00
Mike Pennisi 81d00def42 Force "early error" tests to fail if evaluated
This pattern makes expectations more explicit by making test files more
literal.
2017-06-28 11:24:36 -04:00
André Bargull 3291704eb2
Fix multiple test errors
Tests doesn't use async functionality and don't call $DONE, so remove
"async" flag:
- src/params/error/async-gen-named-func-expr.template
- test/language/expressions/async-generator/params-named-dflt-abrupt.js
- test/language/expressions/async-generator/params-named-dflt-ref-later.js
- test/language/expressions/async-generator/params-named-dflt-ref-self.js

Intl.PluralRules.prototype is no longer a Intl.Prototype instance:
- test/intl402/PluralRules/prototype/prototype.js

Intl.PluralRules throws an error when called as a function:
- test/intl402/PluralRules/undefined-newtarget-throws.js

Module namespace objects call OrdinaryDelete for symbol properties:
- test/language/module-code/namespace/internals/delete-non-exported.js

Async generators no longer retrieves "done" property twice:
- src/async-generators/yield-star-async-next.case
- src/async-generators/yield-star-async-return.case
- src/async-generators/yield-star-async-throw.case

Minor units of CLF is 4, so we need to test with maximumFractionDigits=3
to get an error:
- test/intl402/NumberFormat/dft-currency-mnfd-range-check-mxfd.js

DateTimeFormat.prototype.formatToParts length property was changed from
0 to 1:
- test/intl402/DateTimeFormat/prototype/formatToParts/length.js

minimumSignificantDigits and maximumSignificantDigits properties are
only retrieved once:
- test/intl402/NumberFormat/11.1.1_32.js
2017-04-06 15:30:13 -04:00
Leo Balter 763649d268 Fix runtime error tests previously marked as early errors (#881)
Fixes #877
Ref #872
2017-03-13 11:09:04 -04:00
André Bargull 2871a9c8ed Update tests for cyclic module dependencies through export* (#868)
Cyclic dependencies are no longer an error per
https://github.com/tc39/ecma262/pull/783.
2017-03-01 16:59:53 -05:00
André Bargull 6b09ad0459 Update YAML frontmatter of some tests to be compatible with monkeyYaml (#862) 2017-03-01 16:35:37 -05:00
André Bargull 204266794c Fix various test issues (#840)
test/annexB/built-ins/Date/prototype/setYear/time-clip.js
test/built-ins/Date/prototype/setFullYear/new-value-time-clip.js
test/built-ins/Date/prototype/setMonth/new-value-time-clip.js
- Don't try to test time-clip at the end points, because this is near
impossible to get right (needs to consider time zone offset, dst, local
mean time because of Africa/Monrovia, etc.).

test/built-ins/DataView/prototype/setFloat64/detached-buffer-after-toindex-byteoffset.js
test/built-ins/DataView/prototype/setInt16/detached-buffer-after-toindex-byteoffset.js
- Wasn't update to expect RangeError

test/built-ins/Function/internals/Construct/derived-this-uninitialized-realm.js
- Change ClassDeclaration -> ClassExpression to get completion value

test/built-ins/Function/prototype/toString/AsyncFunction.js
- Add missing \n in expected string
- Also fixed in gh-847

test/built-ins/global/global-object.js
- Add 'var' to make test pass in strict-mode

test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-function-declaration.js
- This is allowed in sloppy mode when Annex B is implemented

test/language/expressions/async-generators/expression-yield-as-statement.js
- Fix calls to then()

test/language/module-code/namespace/internals/own-property-keys-binding-types.js
test/language/module-code/namespace/internals/own-property-keys-sort.js
- Tests weren't updated after removal of @@iterator from module
namespace objects

test/language/module-code/namespace/internals/set-prototype-of-null.js
- Fix syntax error

test/language/statements/async-function/early-errors-no-async-generator.js
- No longer valid now that async iteration proposal is at stage 3
2017-02-07 11:10:56 -05:00
Kevin Gibbons a73221eb8f mark namespace object toStringTag as non-configurable (#811) 2016-12-28 14:16:24 -08:00
Adam Klein b5edd1256c Add test for setting a module namespace object's prototype to null (#805)
The behavior changed from returning false to true in
https://github.com/tc39/ecma262/commit/13906140a
2016-12-28 10:58:15 -08:00
Kevin Gibbons 03453d6098 Remove tests for module namespace iterator (#810) 2016-12-28 10:57:46 -08: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 0c29e6de86 Reformat miscellaneous negative tests
The expected errors in these tests cannot be asserted with the
`assert.throws` helper function for various reasons. Re-format their
meta-data according to the latest design in order to more precisely
describe test expectations.
2016-10-19 15:24:19 -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
jugglinmike b9d6fec9ac Correct name of fixture file (#775)
The file previously named `values-binding-types_.js` is not intended to
be interpreted as a test. Therefor (in accordance with the project's
`INTERPETING.md` file), its name should include `_FIXTURE` as a suffix.
2016-10-14 11:04:47 -07:00
Yusuke Suzuki dfd1fb3a97 Fix incorrect value retrieving in module-code test (#741)
Fix language/module-code/namespace/internals/get-own-property-str-found-init.js.
2016-08-04 11:19:36 -04:00
Yusuke Suzuki e2fb909a1d Fix importing filename in module-code/instn-star-err-not-found.js test
Fix the incorrect module filename.
2016-07-30 15:08:26 -04:00
Mike Pennisi 14595b47b8 Add tests for restricted grammar productions 2016-07-02 15:46:16 -04:00
jugglinmike db8ff7cc01 Add tests for Annex B extns to comments (#612) 2016-05-09 18:29:18 -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
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
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
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 82abd59f35 Add test for strict mode of module code 2016-02-19 17:39:41 -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 023c7aa69e - Remove inline license
- Remove duplicate word
- Add missing license
2015-07-17 19:55:00 +02:00
Mike Pennisi 48dbddebdb Fix typo in test meta-data
The `Negative` tag accepts a string value (not a list)
2015-06-17 15:44:54 -04:00
Mike Pennisi c7fb97765e Insert omitted `negative` tag
This test exercises an early error, so it should be declared with the
`negative` tag.
2015-06-09 19:48:29 -04:00
Mike Pennisi b8b462316b Add tests for early errors in module syntax
Introduce the `module` flag to unambiguously identify tests that are
intended to be interpreted as module code.
2015-06-03 13:15:15 -04:00