mirror of https://github.com/tc39/test262.git
[generation] Avoid generating trailing whitespace
This commit is contained in:
parent
82051d8f6a
commit
3777273b5d
|
@ -20,7 +20,11 @@ def indent(text, prefix = ' '):
|
||||||
else:
|
else:
|
||||||
lines = text.split('\n')
|
lines = text.split('\n')
|
||||||
|
|
||||||
return prefix + ('\n' + prefix).join(lines)
|
indented = map(
|
||||||
|
lambda line: line if len(line) == 0 else prefix + line,
|
||||||
|
lines)
|
||||||
|
|
||||||
|
return '\n'.join(indented)
|
||||||
|
|
||||||
class Template:
|
class Template:
|
||||||
def __init__(self, filename):
|
def __init__(self, filename):
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - tools/generation/test/fixtures/normal.case
|
||||||
|
// - tools/generation/test/fixtures/normal/info-multiline-folding.template
|
||||||
|
/*---
|
||||||
|
description: foobar (First template name)
|
||||||
|
es6id: 1.2.3
|
||||||
|
flags: [generated, a, b]
|
||||||
|
includes: [foo.js]
|
||||||
|
info: >
|
||||||
|
This is an "info" field with an
|
||||||
|
|
||||||
|
empty line
|
||||||
|
Trailing white space in the template:
|
||||||
|
should be preserved:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case info
|
||||||
|
---*/
|
||||||
|
|
||||||
|
// Trailing white space in the test body:
|
||||||
|
// should be preserved:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'This is "teardown" code.';
|
|
@ -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: 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:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue