[generation] Parse and render new error format

Extend the test generation tool to emit the recently-modified format of
the "negative" meta-data. Update the effected test case files
accordingly.
This commit is contained in:
Mike Pennisi 2016-05-28 15:44:54 -04:00
parent 0c29e6de86
commit 7f6e6d137d
42 changed files with 150 additions and 38 deletions

View File

@ -5,7 +5,9 @@ desc: >
It is a Syntax Error if BoundNames of FormalParameters contains any duplicate It is a Syntax Error if BoundNames of FormalParameters contains any duplicate
elements. elements.
template: syntax template: syntax
negative: SyntaxError negative:
phase: early
type: SyntaxError
info: | info: |
14.1.2 Static Semantics: Early Errors 14.1.2 Static Semantics: Early Errors

View File

@ -20,7 +20,9 @@ info: |
...BindingIdentifier[?Yield] ...BindingIdentifier[?Yield]
...BindingPattern[?Yield] ...BindingPattern[?Yield]
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- params //- params

View File

@ -10,7 +10,9 @@ desc: >
template: syntax template: syntax
es6id: 12.14.5.1 es6id: 12.14.5.1
flags: [onlyStrict] flags: [onlyStrict]
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -8,7 +8,9 @@ desc: >
template: syntax template: syntax
es6id: 12.14.5.4 es6id: 12.14.5.4
flags: [onlyStrict] flags: [onlyStrict]
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -9,7 +9,9 @@ desc: >
AssignmentPattern as the goal symbol. AssignmentPattern as the goal symbol.
template: syntax template: syntax
es6id: 12.14.5.1 es6id: 12.14.5.1
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -9,7 +9,9 @@ desc: >
template: syntax template: syntax
es6id: 12.14.5.3 es6id: 12.14.5.3
flags: [onlyStrict] flags: [onlyStrict]
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -9,7 +9,9 @@ desc: >
AssignmentPattern as the goal symbol. AssignmentPattern as the goal symbol.
template: syntax template: syntax
es6id: 12.14.5.1 es6id: 12.14.5.1
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -9,7 +9,9 @@ desc: >
template: syntax template: syntax
es6id: 12.14.5.3 es6id: 12.14.5.3
flags: [onlyStrict] flags: [onlyStrict]
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -10,7 +10,9 @@ desc: >
template: syntax template: syntax
es6id: 12.14.5.1 es6id: 12.14.5.1
flags: [onlyStrict] flags: [onlyStrict]
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -9,7 +9,9 @@ desc: >
template: syntax template: syntax
es6id: 12.14.5.4 es6id: 12.14.5.4
flags: [onlyStrict] flags: [onlyStrict]
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -7,7 +7,9 @@ desc: >
AssignmentElementList. AssignmentElementList.
template: syntax template: syntax
es6id: 12.14.5 es6id: 12.14.5
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -7,7 +7,9 @@ desc: >
AssignmentElementList. AssignmentElementList.
template: syntax template: syntax
es6id: 12.14.5 es6id: 12.14.5
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -7,7 +7,9 @@ desc: >
AssignmentElementList. AssignmentElementList.
template: syntax template: syntax
es6id: 12.14.5 es6id: 12.14.5
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -7,7 +7,9 @@ desc: >
AssignmentRestElement in a AssignmentElementList. AssignmentRestElement in a AssignmentElementList.
template: syntax template: syntax
es6id: 12.14.5 es6id: 12.14.5
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -6,7 +6,9 @@ desc: >
The AssignmentRestElement does not support an initializer. The AssignmentRestElement does not support an initializer.
template: syntax template: syntax
es6id: 12.14.5 es6id: 12.14.5
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- setup //- setup

View File

@ -9,7 +9,9 @@ desc: >
AssignmentPattern as the goal symbol. AssignmentPattern as the goal symbol.
template: syntax template: syntax
es6id: 12.14.5.1 es6id: 12.14.5.1
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -9,7 +9,9 @@ desc: >
template: syntax template: syntax
es6id: 12.14.5.3 es6id: 12.14.5.3
flags: [onlyStrict] flags: [onlyStrict]
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -9,7 +9,9 @@ desc: >
AssignmentPattern as the goal symbol. AssignmentPattern as the goal symbol.
template: syntax template: syntax
es6id: 12.14.5.1 es6id: 12.14.5.1
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -9,7 +9,9 @@ desc: >
template: syntax template: syntax
es6id: 12.14.5.3 es6id: 12.14.5.3
flags: [onlyStrict] flags: [onlyStrict]
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -9,7 +9,9 @@ desc: >
template: syntax template: syntax
es6id: 12.14.5 es6id: 12.14.5
flags: [onlyStrict] flags: [onlyStrict]
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- setup //- setup

View File

@ -9,7 +9,9 @@ template: syntax
es6id: 12.14.5 es6id: 12.14.5
flags: [noStrict] flags: [noStrict]
features: [generators] features: [generators]
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- setup //- setup

View File

@ -8,7 +8,9 @@ desc: >
template: syntax template: syntax
es6id: 12.14.5 es6id: 12.14.5
flags: [onlyStrict] flags: [onlyStrict]
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -8,7 +8,9 @@ desc: >
template: syntax template: syntax
es6id: 12.14.5.1 es6id: 12.14.5.1
flags: [onlyStrict] flags: [onlyStrict]
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -9,7 +9,9 @@ desc: >
template: syntax template: syntax
es6id: 12.14.5 es6id: 12.14.5
flags: [onlyStrict] flags: [onlyStrict]
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -8,7 +8,9 @@ desc: >
template: syntax template: syntax
es6id: 12.14.5.1 es6id: 12.14.5.1
flags: [onlyStrict] flags: [onlyStrict]
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -9,7 +9,9 @@ desc: >
template: syntax template: syntax
es6id: 12.14.5.4 es6id: 12.14.5.4
flags: [onlyStrict] flags: [onlyStrict]
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -9,7 +9,9 @@ desc: >
template: syntax template: syntax
es6id: 12.14.5.4 es6id: 12.14.5.4
flags: [onlyStrict] flags: [onlyStrict]
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -9,7 +9,9 @@ desc: >
AssignmentPattern as the goal symbol. AssignmentPattern as the goal symbol.
template: syntax template: syntax
es6id: 12.14.5.1 es6id: 12.14.5.1
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -9,7 +9,9 @@ desc: >
template: syntax template: syntax
es6id: 12.14.5.4 es6id: 12.14.5.4
flags: [onlyStrict] flags: [onlyStrict]
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -10,7 +10,9 @@ desc: >
the goal symbol. the goal symbol.
template: syntax template: syntax
es6id: 12.14.5.1 es6id: 12.14.5.1
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -9,7 +9,9 @@ desc: >
template: syntax template: syntax
es6id: 12.14.5.4 es6id: 12.14.5.4
flags: [onlyStrict] flags: [onlyStrict]
negative: SyntaxError negative:
phase: early
type: SyntaxError
---*/ ---*/
//- elems //- elems

View File

@ -3,7 +3,9 @@
/*--- /*---
template: default template: default
desc: Reset element (nested array pattern) does not support initializer desc: Reset element (nested array pattern) does not support initializer
negative: SyntaxError negative:
phase: early
type: SyntaxError
info: > info: >
13.3.3 Destructuring Binding Patterns 13.3.3 Destructuring Binding Patterns

View File

@ -3,7 +3,9 @@
/*--- /*---
template: default template: default
desc: Reset element (identifier) does not support initializer desc: Reset element (identifier) does not support initializer
negative: SyntaxError negative:
phase: early
type: SyntaxError
info: > info: >
13.3.3 Destructuring Binding Patterns 13.3.3 Destructuring Binding Patterns

View File

@ -3,7 +3,9 @@
/*--- /*---
template: default template: default
desc: Reset element (nested object pattern) does not support initializer desc: Reset element (nested object pattern) does not support initializer
negative: SyntaxError negative:
phase: early
type: SyntaxError
info: > info: >
13.3.3 Destructuring Binding Patterns 13.3.3 Destructuring Binding Patterns

View File

@ -3,7 +3,9 @@
/*--- /*---
template: default template: default
desc: Rest element (array binding pattern) may not be followed by any element desc: Rest element (array binding pattern) may not be followed by any element
negative: SyntaxError negative:
phase: early
type: SyntaxError
info: > info: >
13.3.3 Destructuring Binding Patterns 13.3.3 Destructuring Binding Patterns

View File

@ -3,7 +3,9 @@
/*--- /*---
template: default template: default
desc: Rest element (identifier) may not be followed by any element desc: Rest element (identifier) may not be followed by any element
negative: SyntaxError negative:
phase: early
type: SyntaxError
info: > info: >
13.3.3 Destructuring Binding Patterns 13.3.3 Destructuring Binding Patterns

View File

@ -3,7 +3,9 @@
/*--- /*---
template: default template: default
desc: Rest element (object binding pattern) may not be followed by any element desc: Rest element (object binding pattern) may not be followed by any element
negative: SyntaxError negative:
phase: early
type: SyntaxError
info: > info: >
13.3.3 Destructuring Binding Patterns 13.3.3 Destructuring Binding Patterns

View File

@ -144,7 +144,10 @@ class Template:
lines += ['includes: ' + yaml.dump(includes).strip()] lines += ['includes: ' + yaml.dump(includes).strip()]
if case_values['meta'].get('negative'): if case_values['meta'].get('negative'):
lines += ['negative: ' + case_values['meta'].get('negative')] lines += ['negative:']
as_yaml = yaml.dump(case_values['meta'].get('negative'),
default_flow_style=False)
lines += indent(as_yaml.strip(), ' ').split('\n')
info = [] info = []

View File

@ -0,0 +1,13 @@
// This file was procedurally generated from the following sources:
// - tools/generation/test/fixtures/negative.case
// - tools/generation/test/fixtures/negative/negative.template
/*---
description: foobar (The "negative" field should be emitted in the output files)
es6id: 1.2.3
flags: [generated]
negative:
phase: early
type: ReferenceError
info: |
case info
---*/

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: negative
desc: foobar
info: case info
negative:
phase: early
type: ReferenceError
---*/

View File

@ -0,0 +1,7 @@
// Copyright (C) 2016 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
name: The "negative" field should be emitted in the output files
path: negative/negative-
es6id: 1.2.3
---*/

View File

@ -54,5 +54,10 @@ class TestGeneration(unittest.TestCase):
self.assertEqual(result['returncode'], 0) self.assertEqual(result['returncode'], 0)
self.compareTrees('normal') self.compareTrees('normal')
def test_negative(self):
result = self.fixture('negative.case')
self.assertEqual(result['returncode'], 0)
self.compareTrees('negative')
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()