diff options
author | Mike Pennisi <mike@mikepennisi.com> | 2017-12-03 00:20:06 -0500 |
---|---|---|
committer | Rick Waldron <waldron.rick@gmail.com> | 2018-01-05 15:17:51 -0500 |
commit | e6d674ef7ae0f0d82875a2abafbaf0c63db7cef1 (patch) | |
tree | f78f0176aa79c50f225fd77c59431e0c692e0301 | |
parent | 136110378bb62fefb5a9a69080067e6f126f9dae (diff) | |
download | qtdeclarative-testsuites-e6d674ef7ae0f0d82875a2abafbaf0c63db7cef1.tar.gz |
Rename negative test "phase" for module resolution
-rw-r--r-- | CONTRIBUTING.md | 2 | ||||
-rw-r--r-- | INTERPRETING.md | 5 | ||||
-rw-r--r-- | test/language/module-code/instn-resolve-empty-export.js | 2 | ||||
-rw-r--r-- | test/language/module-code/instn-resolve-empty-import.js | 2 | ||||
-rw-r--r-- | test/language/module-code/instn-resolve-err-reference.js | 2 | ||||
-rw-r--r-- | test/language/module-code/instn-resolve-err-syntax.js | 2 | ||||
-rw-r--r-- | test/language/module-code/instn-resolve-order-depth.js | 2 | ||||
-rw-r--r-- | test/language/module-code/instn-resolve-order-src.js | 2 | ||||
-rw-r--r-- | tools/lint/lib/checks/negative.py | 2 | ||||
-rw-r--r-- | tools/lint/test/fixtures/negative_resolution_throw_bad_value.js | 16 | ||||
-rw-r--r-- | tools/lint/test/fixtures/negative_resolution_throw_missing.js | 14 | ||||
-rw-r--r-- | tools/lint/test/fixtures/negative_valid_resolution.js | 15 |
12 files changed, 56 insertions, 10 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 582974de8..1a3e8ddd3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -103,7 +103,7 @@ single line comment syntax. This means the test is expected to throw an error of the given type. If no error is thrown, a test failure is reported. - **type**- If an error is thrown, it is implicitly converted to a string. In order for the test to pass, this value must match the name of the error constructor. -- **phase** - Negative tests whose **phase** value is "parse" must produce the specified error prior to executing code. The value "runtime" dictates that the error is expected to be produced as a result of executing the test code. +- **phase** - Negative tests whose **phase** value is "parse" must produce the specified error prior to executing code. The value "resolution" indicates that the error is expected to result while performing ES2015 module resolution. The value "runtime" dictates that the error is expected to be produced as a result of executing the test code. For best practices on how to use the negative tag please see [Handling Errors and Negative Test Cases](#handling-errors-and-negative-test-cases), below. diff --git a/INTERPRETING.md b/INTERPRETING.md index c3a31bb65..0a10c7fd2 100644 --- a/INTERPRETING.md +++ b/INTERPRETING.md @@ -162,8 +162,9 @@ attribute is a YAML dictonary with two keys: - `phase` - the stage of the test interpretation process that the error is expected to be produced; either "parse" (meaning, "while parsing the source - text"), "early" (meaning, "prior to evaluation") or "runtime" (meaning, - "during evaluation") + text"), "early" (meaning, "prior to evaluation"), "resolution" (meaining, + "during ES2015 module resolution"), or "runtime" (meaning, "during + evaluation") - `type` - the name of the constructor of the expected error If a test configured with the `negative` attribute completes without throwing diff --git a/test/language/module-code/instn-resolve-empty-export.js b/test/language/module-code/instn-resolve-empty-export.js index d602d809a..86b03d3b4 100644 --- a/test/language/module-code/instn-resolve-empty-export.js +++ b/test/language/module-code/instn-resolve-empty-export.js @@ -30,7 +30,7 @@ info: | { ExportsList } { ExportsList , } negative: - phase: early + phase: resolution type: ReferenceError flags: [module] ---*/ diff --git a/test/language/module-code/instn-resolve-empty-import.js b/test/language/module-code/instn-resolve-empty-import.js index 5dccc354e..3a5b07f4e 100644 --- a/test/language/module-code/instn-resolve-empty-import.js +++ b/test/language/module-code/instn-resolve-empty-import.js @@ -36,7 +36,7 @@ info: | { ImportsList } { ImportsList , } negative: - phase: early + phase: resolution type: ReferenceError flags: [module] ---*/ diff --git a/test/language/module-code/instn-resolve-err-reference.js b/test/language/module-code/instn-resolve-err-reference.js index 9e7e458fb..1e6126f57 100644 --- a/test/language/module-code/instn-resolve-err-reference.js +++ b/test/language/module-code/instn-resolve-err-reference.js @@ -11,7 +11,7 @@ info: | b. Let requiredModule be ? HostResolveImportedModule(module, required). [...] negative: - phase: early + phase: resolution type: ReferenceError flags: [module] ---*/ diff --git a/test/language/module-code/instn-resolve-err-syntax.js b/test/language/module-code/instn-resolve-err-syntax.js index ab3593441..e26e5e9de 100644 --- a/test/language/module-code/instn-resolve-err-syntax.js +++ b/test/language/module-code/instn-resolve-err-syntax.js @@ -11,7 +11,7 @@ info: | b. Let requiredModule be ? HostResolveImportedModule(module, required). [...] negative: - phase: early + phase: resolution type: SyntaxError flags: [module] ---*/ diff --git a/test/language/module-code/instn-resolve-order-depth.js b/test/language/module-code/instn-resolve-order-depth.js index e50de90b3..ae889b5a6 100644 --- a/test/language/module-code/instn-resolve-order-depth.js +++ b/test/language/module-code/instn-resolve-order-depth.js @@ -4,7 +4,7 @@ description: Module dependencies are resolved following a depth-first strategy esid: sec-moduledeclarationinstantiation negative: - phase: early + phase: resolution type: ReferenceError flags: [module] ---*/ diff --git a/test/language/module-code/instn-resolve-order-src.js b/test/language/module-code/instn-resolve-order-src.js index a301f599f..31bcbfdb9 100644 --- a/test/language/module-code/instn-resolve-order-src.js +++ b/test/language/module-code/instn-resolve-order-src.js @@ -4,7 +4,7 @@ description: Modules dependencies are resolved in source text order esid: sec-moduledeclarationinstantiation negative: - phase: early + phase: resolution type: ReferenceError flags: [module] ---*/ diff --git a/tools/lint/lib/checks/negative.py b/tools/lint/lib/checks/negative.py index aa9ec1e40..666cde76e 100644 --- a/tools/lint/lib/checks/negative.py +++ b/tools/lint/lib/checks/negative.py @@ -23,5 +23,5 @@ class CheckNegative(Check): if not 'phase' in negative: return '"negative" must specify a "phase" field' - if negative["phase"] == "parse" and not _THROW_STMT.search(source): + if negative["phase"] in ["parse", "resolution"] and not _THROW_STMT.search(source): return 'Negative tests of type "early" must include a `throw` statement' diff --git a/tools/lint/test/fixtures/negative_resolution_throw_bad_value.js b/tools/lint/test/fixtures/negative_resolution_throw_bad_value.js new file mode 100644 index 000000000..daf09d5e8 --- /dev/null +++ b/tools/lint/test/fixtures/negative_resolution_throw_bad_value.js @@ -0,0 +1,16 @@ +NEGATIVE +^ expected errors | v input +// Copyright (C) 2017 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +description: Minimal test +flags: [module] +negative: + type: SyntaxError + phase: resolution +---*/ + +throw "Test262: This statement should not be evaluated!"; + +import 'non-existent-module.js'; diff --git a/tools/lint/test/fixtures/negative_resolution_throw_missing.js b/tools/lint/test/fixtures/negative_resolution_throw_missing.js new file mode 100644 index 000000000..8892676e2 --- /dev/null +++ b/tools/lint/test/fixtures/negative_resolution_throw_missing.js @@ -0,0 +1,14 @@ +NEGATIVE +^ expected errors | v input +// Copyright (C) 2017 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +description: Minimal test +flags: [module] +negative: + type: SyntaxError + phase: resolution +---*/ + +import 'non-existent-module.js'; diff --git a/tools/lint/test/fixtures/negative_valid_resolution.js b/tools/lint/test/fixtures/negative_valid_resolution.js new file mode 100644 index 000000000..b3068c7fe --- /dev/null +++ b/tools/lint/test/fixtures/negative_valid_resolution.js @@ -0,0 +1,15 @@ +^ expected errors | v input +// Copyright (C) 2017 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +description: Minimal test +flags: [module] +negative: + type: SyntaxError + phase: resolution +---*/ + +throw "Test262: This statement should not be evaluated."; + +import 'non-existent-module.js'; |