mirror of
https://github.com/tc39/test262.git
synced 2025-07-22 21:45:04 +02:00
Enable configuration of templates for generated tests. Fixes gh-1049
This commit is contained in:
parent
99ceda42a4
commit
5b54058ad7
@ -385,7 +385,8 @@ Test cases and test templates specify meta-data using the same YAML frontmatter
|
|||||||
### test cases (`*.case`)
|
### test cases (`*.case`)
|
||||||
Field | Description
|
Field | Description
|
||||||
------|-------------
|
------|-------------
|
||||||
`template` | name of the sub-directory to locate templates for this test
|
`template` | a template file, directory or glob expression.
|
||||||
|
`templates` | a list of template file, directory or glob expressions.
|
||||||
`desc` | see the frontmatter definition of the "desc" field. The generated test will have a have final "desc" value which is this text appended with the test template's "name" field in parentheses.
|
`desc` | see the frontmatter definition of the "desc" field. The generated test will have a have final "desc" value which is this text appended with the test template's "name" field in parentheses.
|
||||||
`info` | see the frontmatter definition of the "info" field. The generated test will have a have final "info" value which is this text concatenated at the end of the test templates's "info" text.
|
`info` | see the frontmatter definition of the "info" field. The generated test will have a have final "info" value which is this text concatenated at the end of the test templates's "info" text.
|
||||||
`features` | see the frontmatter definition of the "features" field. The generated test will have a final feature list in combination with the template's feature field.
|
`features` | see the frontmatter definition of the "features" field. The generated test will have a final feature list in combination with the template's feature field.
|
||||||
|
@ -22,14 +22,13 @@ class Case:
|
|||||||
region_name = None
|
region_name = None
|
||||||
region_start = 0
|
region_start = 0
|
||||||
lines = source.split('\n')
|
lines = source.split('\n')
|
||||||
matches = re.finditer(metaPattern, source, re.MULTILINE)
|
search = re.search(metaPattern, source, re.DOTALL|re.MULTILINE)
|
||||||
|
|
||||||
for matchNum, match in enumerate(matches, start=1):
|
if search:
|
||||||
meta = "{match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group())
|
meta = search.group()
|
||||||
meta = parse_yaml(meta[2:-2])
|
meta = parse_yaml(meta[2:-2])
|
||||||
if meta and not case['meta']:
|
if meta and not case['meta']:
|
||||||
case['meta'] = meta
|
case['meta'] = meta
|
||||||
break
|
|
||||||
|
|
||||||
for comment in find_comments(source):
|
for comment in find_comments(source):
|
||||||
match = regionStartPattern.match(comment['source'])
|
match = regionStartPattern.match(comment['source'])
|
||||||
|
@ -60,9 +60,17 @@ class Expander:
|
|||||||
|
|
||||||
def expand_case(self, file_name, encoding):
|
def expand_case(self, file_name, encoding):
|
||||||
case = Case(file_name, encoding)
|
case = Case(file_name, encoding)
|
||||||
|
localtemplates = [];
|
||||||
|
|
||||||
template_class = case.attribs['meta']['template']
|
if 'template' in case.attribs['meta']:
|
||||||
templates = self.templates.get(template_class)
|
localtemplates.append(case.attribs['meta']['template'])
|
||||||
|
|
||||||
for template in self._get_templates(template_class, encoding):
|
if 'templates' in case.attribs['meta']:
|
||||||
yield template.expand(file_name, os.path.basename(file_name[:-5]), case.attribs, encoding)
|
localtemplates.extend(case.attribs['meta']['templates'])
|
||||||
|
|
||||||
|
for t in localtemplates:
|
||||||
|
template_class = t
|
||||||
|
templates = self.templates.get(template_class)
|
||||||
|
|
||||||
|
for template in self._get_templates(template_class, encoding):
|
||||||
|
yield template.expand(file_name, os.path.basename(file_name[:-5]), case.attribs, encoding)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - tools/generation/test/fixtures/glob-expr.case
|
// - tools/generation/test/fixtures/glob-expr.case
|
||||||
// - tools/generation/test/fixtures/glob/a/normal2.template
|
// - tools/generation/test/fixtures/glob-expr/a/normal2.template
|
||||||
/*---
|
/*---
|
||||||
description: foobar (Second template name)
|
description: foobar (Second template name)
|
||||||
esid: sec-a-generic-id
|
esid: sec-a-generic-id
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - tools/generation/test/fixtures/glob-expr.case
|
// - tools/generation/test/fixtures/glob-expr.case
|
||||||
// - tools/generation/test/fixtures/glob/a/normal.template
|
// - tools/generation/test/fixtures/glob-expr/a/normal.template
|
||||||
/*---
|
/*---
|
||||||
description: foobar (First template name)
|
description: foobar (First template name)
|
||||||
es6id: 1.2.3
|
es6id: 1.2.3
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - tools/generation/test/fixtures/glob-expr.case
|
// - tools/generation/test/fixtures/glob-expr.case
|
||||||
// - tools/generation/test/fixtures/glob/b/normal2.template
|
// - tools/generation/test/fixtures/glob-expr/b/normal2.template
|
||||||
/*---
|
/*---
|
||||||
description: foobar (Second template name)
|
description: foobar (Second template name)
|
||||||
esid: sec-a-generic-id
|
esid: sec-a-generic-id
|
@ -1,6 +1,6 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - tools/generation/test/fixtures/glob-expr.case
|
// - tools/generation/test/fixtures/glob-expr.case
|
||||||
// - tools/generation/test/fixtures/glob/b/normal.template
|
// - tools/generation/test/fixtures/glob-expr/b/normal.template
|
||||||
/*---
|
/*---
|
||||||
description: foobar (First template name)
|
description: foobar (First template name)
|
||||||
es6id: 1.2.3
|
es6id: 1.2.3
|
@ -0,0 +1,36 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - tools/generation/test/fixtures/multiple-templates.case
|
||||||
|
// - tools/generation/test/fixtures/multiple/glob/normal.template
|
||||||
|
/*---
|
||||||
|
description: foobar (First template name)
|
||||||
|
es6id: 1.2.3
|
||||||
|
flags: [generated, a, b, c, d]
|
||||||
|
includes: [foo.js]
|
||||||
|
info: |
|
||||||
|
template info
|
||||||
|
|
||||||
|
case info
|
||||||
|
---*/
|
||||||
|
|
||||||
|
before-First value-between-Third value (Special characters like `≠` should be tolerated.)-after
|
||||||
|
|
||||||
|
before*Second value*between*First value*after
|
||||||
|
|
||||||
|
before/* " */Third value (Special characters like `≠` should be tolerated.)after
|
||||||
|
|
||||||
|
// Special characters like `≠` should be tolerated.
|
||||||
|
|
||||||
|
The following should not be expanded:
|
||||||
|
|
||||||
|
/* */*{ first }*/
|
||||||
|
/*
|
||||||
|
*/*{ first }*/
|
||||||
|
//*{ first }*/
|
||||||
|
// /*{ first }*/
|
||||||
|
Quote characters: " ' `
|
||||||
|
"Quote characters: ' ' `"
|
||||||
|
'Quote characters: " " `'
|
||||||
|
`
|
||||||
|
Quote characters: " ' '`
|
||||||
|
|
||||||
|
'This is "teardown" code.';
|
@ -0,0 +1,19 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - tools/generation/test/fixtures/multiple-templates.case
|
||||||
|
// - tools/generation/test/fixtures/multiple/glob/normal2.template
|
||||||
|
/*---
|
||||||
|
description: foobar (Second template name)
|
||||||
|
esid: sec-a-generic-id
|
||||||
|
flags: [generated, a, b]
|
||||||
|
includes: [foo.js, bar.js]
|
||||||
|
info: |
|
||||||
|
template info
|
||||||
|
|
||||||
|
case info
|
||||||
|
---*/
|
||||||
|
|
||||||
|
before-Third value (Special characters like `≠` should be tolerated.)Second value-after
|
||||||
|
|
||||||
|
/* Improperly-terminated comments should not break the tokenizer *
|
||||||
|
|
||||||
|
'This is "teardown" code.';
|
@ -0,0 +1,19 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - tools/generation/test/fixtures/multiple-templates.case
|
||||||
|
// - tools/generation/test/fixtures/multiple/a/normal2.template
|
||||||
|
/*---
|
||||||
|
description: foobar (Second template name)
|
||||||
|
esid: sec-a-generic-id
|
||||||
|
flags: [generated, a, b]
|
||||||
|
includes: [foo.js, bar.js]
|
||||||
|
info: |
|
||||||
|
template info
|
||||||
|
|
||||||
|
case info
|
||||||
|
---*/
|
||||||
|
|
||||||
|
before-Third value (Special characters like `≠` should be tolerated.)Second value-after
|
||||||
|
|
||||||
|
/* Improperly-terminated comments should not break the tokenizer *
|
||||||
|
|
||||||
|
'This is "teardown" code.';
|
@ -0,0 +1,15 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - tools/generation/test/fixtures/multiple-templates.case
|
||||||
|
// - tools/generation/test/fixtures/multiple/a/no-info.template
|
||||||
|
/*---
|
||||||
|
description: foobar (First template name)
|
||||||
|
es6id: 1.2.3
|
||||||
|
flags: [generated, a, b]
|
||||||
|
includes: [foo.js]
|
||||||
|
info: |
|
||||||
|
case info
|
||||||
|
---*/
|
||||||
|
|
||||||
|
First value
|
||||||
|
|
||||||
|
'This is "teardown" code.';
|
@ -0,0 +1,36 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - tools/generation/test/fixtures/multiple-templates.case
|
||||||
|
// - tools/generation/test/fixtures/multiple/a/normal.template
|
||||||
|
/*---
|
||||||
|
description: foobar (First template name)
|
||||||
|
es6id: 1.2.3
|
||||||
|
flags: [generated, a, b, c, d]
|
||||||
|
includes: [foo.js]
|
||||||
|
info: |
|
||||||
|
template info
|
||||||
|
|
||||||
|
case info
|
||||||
|
---*/
|
||||||
|
|
||||||
|
before-First value-between-Third value (Special characters like `≠` should be tolerated.)-after
|
||||||
|
|
||||||
|
before*Second value*between*First value*after
|
||||||
|
|
||||||
|
before/* " */Third value (Special characters like `≠` should be tolerated.)after
|
||||||
|
|
||||||
|
// Special characters like `≠` should be tolerated.
|
||||||
|
|
||||||
|
The following should not be expanded:
|
||||||
|
|
||||||
|
/* */*{ first }*/
|
||||||
|
/*
|
||||||
|
*/*{ first }*/
|
||||||
|
//*{ first }*/
|
||||||
|
// /*{ first }*/
|
||||||
|
Quote characters: " ' `
|
||||||
|
"Quote characters: ' ' `"
|
||||||
|
'Quote characters: " " `'
|
||||||
|
`
|
||||||
|
Quote characters: " ' '`
|
||||||
|
|
||||||
|
'This is "teardown" code.';
|
@ -0,0 +1,14 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - tools/generation/test/fixtures/multiple-templates.case
|
||||||
|
// - tools/generation/test/fixtures/multiple/b/features.template
|
||||||
|
/*---
|
||||||
|
description: foobar (First template name)
|
||||||
|
es6id: 1.2.3
|
||||||
|
features: [f1]
|
||||||
|
flags: [generated, a, b]
|
||||||
|
includes: [foo.js]
|
||||||
|
info: |
|
||||||
|
case info
|
||||||
|
---*/
|
||||||
|
|
||||||
|
'This is "teardown" code.';
|
@ -0,0 +1,19 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - tools/generation/test/fixtures/multiple-templates.case
|
||||||
|
// - tools/generation/test/fixtures/multiple/b/normal2.template
|
||||||
|
/*---
|
||||||
|
description: foobar (Second template name)
|
||||||
|
esid: sec-a-generic-id
|
||||||
|
flags: [generated, a, b]
|
||||||
|
includes: [foo.js, bar.js]
|
||||||
|
info: |
|
||||||
|
template info
|
||||||
|
|
||||||
|
case info
|
||||||
|
---*/
|
||||||
|
|
||||||
|
before-Third value (Special characters like `≠` should be tolerated.)Second value-after
|
||||||
|
|
||||||
|
/* Improperly-terminated comments should not break the tokenizer *
|
||||||
|
|
||||||
|
'This is "teardown" code.';
|
@ -0,0 +1,36 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - tools/generation/test/fixtures/multiple-templates.case
|
||||||
|
// - tools/generation/test/fixtures/multiple/b/normal.template
|
||||||
|
/*---
|
||||||
|
description: foobar (First template name)
|
||||||
|
es6id: 1.2.3
|
||||||
|
flags: [generated, a, b, c, d]
|
||||||
|
includes: [foo.js]
|
||||||
|
info: |
|
||||||
|
template info
|
||||||
|
|
||||||
|
case info
|
||||||
|
---*/
|
||||||
|
|
||||||
|
before-First value-between-Third value (Special characters like `≠` should be tolerated.)-after
|
||||||
|
|
||||||
|
before*Second value*between*First value*after
|
||||||
|
|
||||||
|
before/* " */Third value (Special characters like `≠` should be tolerated.)after
|
||||||
|
|
||||||
|
// Special characters like `≠` should be tolerated.
|
||||||
|
|
||||||
|
The following should not be expanded:
|
||||||
|
|
||||||
|
/* */*{ first }*/
|
||||||
|
/*
|
||||||
|
*/*{ first }*/
|
||||||
|
//*{ first }*/
|
||||||
|
// /*{ first }*/
|
||||||
|
Quote characters: " ' `
|
||||||
|
"Quote characters: ' ' `"
|
||||||
|
'Quote characters: " " `'
|
||||||
|
`
|
||||||
|
Quote characters: " ' '`
|
||||||
|
|
||||||
|
'This is "teardown" code.';
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
template: glob/**/normal*.template
|
template: glob-expr/**/normal*.template
|
||||||
desc: foobar
|
desc: foobar
|
||||||
info: case info
|
info: case info
|
||||||
flags: [a, b]
|
flags: [a, b]
|
||||||
|
8
tools/generation/test/fixtures/glob-expr/a/features.template
vendored
Normal file
8
tools/generation/test/fixtures/glob-expr/a/features.template
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: First template name
|
||||||
|
path: glob-expr/normal/a-features-
|
||||||
|
es6id: 1.2.3
|
||||||
|
features: [f1]
|
||||||
|
---*/
|
30
tools/generation/test/fixtures/glob-expr/a/info-multiline-folding.template
vendored
Normal file
30
tools/generation/test/fixtures/glob-expr/a/info-multiline-folding.template
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: First template name
|
||||||
|
path: glob-expr/normal/a-info-multiline-folding-
|
||||||
|
es6id: 1.2.3
|
||||||
|
info: |
|
||||||
|
This is an "info" field with an
|
||||||
|
|
||||||
|
empty line
|
||||||
|
Trailing white space in the template:
|
||||||
|
should be preserved:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
// Trailing white space in the test body:
|
||||||
|
// should be preserved:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
9
tools/generation/test/fixtures/glob-expr/a/no-info.template
vendored
Normal file
9
tools/generation/test/fixtures/glob-expr/a/no-info.template
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: First template name
|
||||||
|
path: glob-expr/normal/a-no-info-
|
||||||
|
es6id: 1.2.3
|
||||||
|
---*/
|
||||||
|
|
||||||
|
/*{ first }*/
|
30
tools/generation/test/fixtures/glob-expr/a/normal.template
vendored
Normal file
30
tools/generation/test/fixtures/glob-expr/a/normal.template
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: First template name
|
||||||
|
path: glob-expr/normal/a-path1-
|
||||||
|
es6id: 1.2.3
|
||||||
|
info: template info
|
||||||
|
flags: [c, d]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
before-/*{ first }*/-between-/*{ third }*/-after
|
||||||
|
|
||||||
|
before*/*{ second }*/*between*/*{ first }*/*after
|
||||||
|
|
||||||
|
before/* " *//*{ third }*/after
|
||||||
|
|
||||||
|
// Special characters like `≠` should be tolerated.
|
||||||
|
|
||||||
|
The following should not be expanded:
|
||||||
|
|
||||||
|
/* */*{ first }*/
|
||||||
|
/*
|
||||||
|
*/*{ first }*/
|
||||||
|
//*{ first }*/
|
||||||
|
// /*{ first }*/
|
||||||
|
/*{ fourth }*/
|
||||||
|
"/*{ fourth }*/"
|
||||||
|
'/*{ fourth }*/'
|
||||||
|
`
|
||||||
|
/*{ fourth }*/`
|
13
tools/generation/test/fixtures/glob-expr/a/normal2.template
vendored
Normal file
13
tools/generation/test/fixtures/glob-expr/a/normal2.template
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: Second template name
|
||||||
|
path: glob-expr/normal/a-nested/path2-
|
||||||
|
esid: sec-a-generic-id
|
||||||
|
includes: [bar.js]
|
||||||
|
info: template info
|
||||||
|
---*/
|
||||||
|
|
||||||
|
before-/*{ third }*//*{ second }*/-after
|
||||||
|
|
||||||
|
/* Improperly-terminated comments should not break the tokenizer *
|
8
tools/generation/test/fixtures/glob-expr/b/features.template
vendored
Normal file
8
tools/generation/test/fixtures/glob-expr/b/features.template
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: First template name
|
||||||
|
path: glob-expr/normal/b-features-
|
||||||
|
es6id: 1.2.3
|
||||||
|
features: [f1]
|
||||||
|
---*/
|
30
tools/generation/test/fixtures/glob-expr/b/info-multiline-folding.template
vendored
Normal file
30
tools/generation/test/fixtures/glob-expr/b/info-multiline-folding.template
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: First template name
|
||||||
|
path: glob-expr/normal/b-info-multiline-folding-
|
||||||
|
es6id: 1.2.3
|
||||||
|
info: |
|
||||||
|
This is an "info" field with an
|
||||||
|
|
||||||
|
empty line
|
||||||
|
Trailing white space in the template:
|
||||||
|
should be preserved:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
// Trailing white space in the test body:
|
||||||
|
// should be preserved:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
9
tools/generation/test/fixtures/glob-expr/b/no-info.template
vendored
Normal file
9
tools/generation/test/fixtures/glob-expr/b/no-info.template
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: First template name
|
||||||
|
path: glob-expr/normal/b-no-info-
|
||||||
|
es6id: 1.2.3
|
||||||
|
---*/
|
||||||
|
|
||||||
|
/*{ first }*/
|
30
tools/generation/test/fixtures/glob-expr/b/normal.template
vendored
Normal file
30
tools/generation/test/fixtures/glob-expr/b/normal.template
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: First template name
|
||||||
|
path: glob-expr/normal/b-path1-
|
||||||
|
es6id: 1.2.3
|
||||||
|
info: template info
|
||||||
|
flags: [c, d]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
before-/*{ first }*/-between-/*{ third }*/-after
|
||||||
|
|
||||||
|
before*/*{ second }*/*between*/*{ first }*/*after
|
||||||
|
|
||||||
|
before/* " *//*{ third }*/after
|
||||||
|
|
||||||
|
// Special characters like `≠` should be tolerated.
|
||||||
|
|
||||||
|
The following should not be expanded:
|
||||||
|
|
||||||
|
/* */*{ first }*/
|
||||||
|
/*
|
||||||
|
*/*{ first }*/
|
||||||
|
//*{ first }*/
|
||||||
|
// /*{ first }*/
|
||||||
|
/*{ fourth }*/
|
||||||
|
"/*{ fourth }*/"
|
||||||
|
'/*{ fourth }*/'
|
||||||
|
`
|
||||||
|
/*{ fourth }*/`
|
13
tools/generation/test/fixtures/glob-expr/b/normal2.template
vendored
Normal file
13
tools/generation/test/fixtures/glob-expr/b/normal2.template
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: Second template name
|
||||||
|
path: glob-expr/normal/b-nested/path2-
|
||||||
|
esid: sec-a-generic-id
|
||||||
|
includes: [bar.js]
|
||||||
|
info: template info
|
||||||
|
---*/
|
||||||
|
|
||||||
|
before-/*{ third }*//*{ second }*/-after
|
||||||
|
|
||||||
|
/* Improperly-terminated comments should not break the tokenizer *
|
32
tools/generation/test/fixtures/multiple-templates.case
vendored
Normal file
32
tools/generation/test/fixtures/multiple-templates.case
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
templates:
|
||||||
|
- multiple/**/normal*.template
|
||||||
|
- multiple/b/features.template
|
||||||
|
- multiple/a/no-info.template
|
||||||
|
desc: foobar
|
||||||
|
info: case info
|
||||||
|
flags: [a, b]
|
||||||
|
includes: [foo.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
Because this test appears before any "region" delimiters, it should not appear
|
||||||
|
in the generated files.
|
||||||
|
|
||||||
|
// - first
|
||||||
|
this is not a valid region delimiter
|
||||||
|
|
||||||
|
/* *//- first
|
||||||
|
this is also not a valid region delimiter
|
||||||
|
|
||||||
|
//- first
|
||||||
|
First value
|
||||||
|
//- second
|
||||||
|
Second value
|
||||||
|
//- third
|
||||||
|
Third value (Special characters like `≠` should be tolerated.)
|
||||||
|
//- fourth
|
||||||
|
Quote characters: " ' `
|
||||||
|
//- teardown
|
||||||
|
'This is "teardown" code.';
|
8
tools/generation/test/fixtures/multiple/a/features.template
vendored
Normal file
8
tools/generation/test/fixtures/multiple/a/features.template
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: First template name
|
||||||
|
path: multiple/normal/a-features-
|
||||||
|
es6id: 1.2.3
|
||||||
|
features: [f1]
|
||||||
|
---*/
|
30
tools/generation/test/fixtures/multiple/a/info-multiline-folding.template
vendored
Normal file
30
tools/generation/test/fixtures/multiple/a/info-multiline-folding.template
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: First template name
|
||||||
|
path: multiple/normal/a-info-multiline-folding-
|
||||||
|
es6id: 1.2.3
|
||||||
|
info: |
|
||||||
|
This is an "info" field with an
|
||||||
|
|
||||||
|
empty line
|
||||||
|
Trailing white space in the template:
|
||||||
|
should be preserved:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
// Trailing white space in the test body:
|
||||||
|
// should be preserved:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
9
tools/generation/test/fixtures/multiple/a/no-info.template
vendored
Normal file
9
tools/generation/test/fixtures/multiple/a/no-info.template
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: First template name
|
||||||
|
path: multiple/normal/a-no-info-
|
||||||
|
es6id: 1.2.3
|
||||||
|
---*/
|
||||||
|
|
||||||
|
/*{ first }*/
|
30
tools/generation/test/fixtures/multiple/a/normal.template
vendored
Normal file
30
tools/generation/test/fixtures/multiple/a/normal.template
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: First template name
|
||||||
|
path: multiple/normal/a-path1-
|
||||||
|
es6id: 1.2.3
|
||||||
|
info: template info
|
||||||
|
flags: [c, d]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
before-/*{ first }*/-between-/*{ third }*/-after
|
||||||
|
|
||||||
|
before*/*{ second }*/*between*/*{ first }*/*after
|
||||||
|
|
||||||
|
before/* " *//*{ third }*/after
|
||||||
|
|
||||||
|
// Special characters like `≠` should be tolerated.
|
||||||
|
|
||||||
|
The following should not be expanded:
|
||||||
|
|
||||||
|
/* */*{ first }*/
|
||||||
|
/*
|
||||||
|
*/*{ first }*/
|
||||||
|
//*{ first }*/
|
||||||
|
// /*{ first }*/
|
||||||
|
/*{ fourth }*/
|
||||||
|
"/*{ fourth }*/"
|
||||||
|
'/*{ fourth }*/'
|
||||||
|
`
|
||||||
|
/*{ fourth }*/`
|
13
tools/generation/test/fixtures/multiple/a/normal2.template
vendored
Normal file
13
tools/generation/test/fixtures/multiple/a/normal2.template
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: Second template name
|
||||||
|
path: multiple/normal/a-nested/path2-
|
||||||
|
esid: sec-a-generic-id
|
||||||
|
includes: [bar.js]
|
||||||
|
info: template info
|
||||||
|
---*/
|
||||||
|
|
||||||
|
before-/*{ third }*//*{ second }*/-after
|
||||||
|
|
||||||
|
/* Improperly-terminated comments should not break the tokenizer *
|
8
tools/generation/test/fixtures/multiple/b/features.template
vendored
Normal file
8
tools/generation/test/fixtures/multiple/b/features.template
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: First template name
|
||||||
|
path: multiple/normal/b-features-
|
||||||
|
es6id: 1.2.3
|
||||||
|
features: [f1]
|
||||||
|
---*/
|
30
tools/generation/test/fixtures/multiple/b/info-multiline-folding.template
vendored
Normal file
30
tools/generation/test/fixtures/multiple/b/info-multiline-folding.template
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: First template name
|
||||||
|
path: multiple/normal/b-info-multiline-folding-
|
||||||
|
es6id: 1.2.3
|
||||||
|
info: |
|
||||||
|
This is an "info" field with an
|
||||||
|
|
||||||
|
empty line
|
||||||
|
Trailing white space in the template:
|
||||||
|
should be preserved:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
// Trailing white space in the test body:
|
||||||
|
// should be preserved:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
9
tools/generation/test/fixtures/multiple/b/no-info.template
vendored
Normal file
9
tools/generation/test/fixtures/multiple/b/no-info.template
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: First template name
|
||||||
|
path: multiple/normal/b-no-info-
|
||||||
|
es6id: 1.2.3
|
||||||
|
---*/
|
||||||
|
|
||||||
|
/*{ first }*/
|
30
tools/generation/test/fixtures/multiple/b/normal.template
vendored
Normal file
30
tools/generation/test/fixtures/multiple/b/normal.template
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: First template name
|
||||||
|
path: multiple/normal/b-path1-
|
||||||
|
es6id: 1.2.3
|
||||||
|
info: template info
|
||||||
|
flags: [c, d]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
before-/*{ first }*/-between-/*{ third }*/-after
|
||||||
|
|
||||||
|
before*/*{ second }*/*between*/*{ first }*/*after
|
||||||
|
|
||||||
|
before/* " *//*{ third }*/after
|
||||||
|
|
||||||
|
// Special characters like `≠` should be tolerated.
|
||||||
|
|
||||||
|
The following should not be expanded:
|
||||||
|
|
||||||
|
/* */*{ first }*/
|
||||||
|
/*
|
||||||
|
*/*{ first }*/
|
||||||
|
//*{ first }*/
|
||||||
|
// /*{ first }*/
|
||||||
|
/*{ fourth }*/
|
||||||
|
"/*{ fourth }*/"
|
||||||
|
'/*{ fourth }*/'
|
||||||
|
`
|
||||||
|
/*{ fourth }*/`
|
13
tools/generation/test/fixtures/multiple/b/normal2.template
vendored
Normal file
13
tools/generation/test/fixtures/multiple/b/normal2.template
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: Second template name
|
||||||
|
path: multiple/normal/b-nested/path2-
|
||||||
|
esid: sec-a-generic-id
|
||||||
|
includes: [bar.js]
|
||||||
|
info: template info
|
||||||
|
---*/
|
||||||
|
|
||||||
|
before-/*{ third }*//*{ second }*/-after
|
||||||
|
|
||||||
|
/* Improperly-terminated comments should not break the tokenizer *
|
8
tools/generation/test/fixtures/multiple/glob/features.template
vendored
Normal file
8
tools/generation/test/fixtures/multiple/glob/features.template
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: First template name
|
||||||
|
path: multiple/glob/features-
|
||||||
|
es6id: 1.2.3
|
||||||
|
features: [f1]
|
||||||
|
---*/
|
30
tools/generation/test/fixtures/multiple/glob/info-multiline-folding.template
vendored
Normal file
30
tools/generation/test/fixtures/multiple/glob/info-multiline-folding.template
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: First template name
|
||||||
|
path: multiple/glob/normal/info-multiline-folding-
|
||||||
|
es6id: 1.2.3
|
||||||
|
info: |
|
||||||
|
This is an "info" field with an
|
||||||
|
|
||||||
|
empty line
|
||||||
|
Trailing white space in the template:
|
||||||
|
should be preserved:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
// Trailing white space in the test body:
|
||||||
|
// should be preserved:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
9
tools/generation/test/fixtures/multiple/glob/no-info.template
vendored
Normal file
9
tools/generation/test/fixtures/multiple/glob/no-info.template
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: First template name
|
||||||
|
path: multiple/glob/normal/no-info-
|
||||||
|
es6id: 1.2.3
|
||||||
|
---*/
|
||||||
|
|
||||||
|
/*{ first }*/
|
30
tools/generation/test/fixtures/multiple/glob/normal.template
vendored
Normal file
30
tools/generation/test/fixtures/multiple/glob/normal.template
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: First template name
|
||||||
|
path: multiple/glob/normal-
|
||||||
|
es6id: 1.2.3
|
||||||
|
info: template info
|
||||||
|
flags: [c, d]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
before-/*{ first }*/-between-/*{ third }*/-after
|
||||||
|
|
||||||
|
before*/*{ second }*/*between*/*{ first }*/*after
|
||||||
|
|
||||||
|
before/* " *//*{ third }*/after
|
||||||
|
|
||||||
|
// Special characters like `≠` should be tolerated.
|
||||||
|
|
||||||
|
The following should not be expanded:
|
||||||
|
|
||||||
|
/* */*{ first }*/
|
||||||
|
/*
|
||||||
|
*/*{ first }*/
|
||||||
|
//*{ first }*/
|
||||||
|
// /*{ first }*/
|
||||||
|
/*{ fourth }*/
|
||||||
|
"/*{ fourth }*/"
|
||||||
|
'/*{ fourth }*/'
|
||||||
|
`
|
||||||
|
/*{ fourth }*/`
|
13
tools/generation/test/fixtures/multiple/glob/normal2.template
vendored
Normal file
13
tools/generation/test/fixtures/multiple/glob/normal2.template
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
name: Second template name
|
||||||
|
path: multiple/glob/normal2-
|
||||||
|
esid: sec-a-generic-id
|
||||||
|
includes: [bar.js]
|
||||||
|
info: template info
|
||||||
|
---*/
|
||||||
|
|
||||||
|
before-/*{ third }*//*{ second }*/-after
|
||||||
|
|
||||||
|
/* Improperly-terminated comments should not break the tokenizer *
|
@ -54,6 +54,16 @@ class TestGeneration(unittest.TestCase):
|
|||||||
self.assertEqual(result['returncode'], 0)
|
self.assertEqual(result['returncode'], 0)
|
||||||
self.compareTrees('glob')
|
self.compareTrees('glob')
|
||||||
|
|
||||||
|
def test_glob_expr(self):
|
||||||
|
result = self.fixture('glob-expr.case')
|
||||||
|
self.assertEqual(result['returncode'], 0)
|
||||||
|
self.compareTrees('glob-expr')
|
||||||
|
|
||||||
|
def test_multiple_templates(self):
|
||||||
|
result = self.fixture('multiple-templates.case')
|
||||||
|
self.assertEqual(result['returncode'], 0)
|
||||||
|
self.compareTrees('multiple-templates')
|
||||||
|
|
||||||
def test_normal(self):
|
def test_normal(self):
|
||||||
result = self.fixture('normal.case')
|
result = self.fixture('normal.case')
|
||||||
self.assertEqual(result['returncode'], 0)
|
self.assertEqual(result['returncode'], 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user