Procedurally generate related tests

Take advantage of a recent extension to the test generation tool in
order to limit duplication.
This commit is contained in:
Mike Pennisi 2017-03-04 10:59:52 -05:00
parent da4e798e5b
commit f03c2c244c
6 changed files with 67 additions and 45 deletions

View File

@ -0,0 +1,22 @@
// Copyright (C) 2017 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: Computed values as accessor property names (string literal containing LineContinuation)
template: default
info: |
12.2.6.7 Runtime Semantics: Evaluation
[...]
ComputedPropertyName : [ AssignmentExpression ]
1. Let exprValue be the result of evaluating AssignmentExpression.
2. Let propName be ? GetValue(exprValue).
3. Return ? ToPropertyKey(propName).
---*/
//- declareWith
'line\
Continuation'
//- referenceWith
'lineContinuation'

View File

@ -1,9 +1,11 @@
// Copyright (C) 2017 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
// This file was procedurally generated from the following sources:
// - src/accessor-names/literal-string-line-continuation.case
// - src/accessor-names/default/cls-expr-inst.template
/*---
description: Computed values as accessor property names (string literal containing a line terminator) (Class expression, instance method)
description: Computed values as accessor property names (string literal containing LineContinuation) (Class expression, instance method)
esid: sec-runtime-semantics-classdefinitionevaluation
es6id: 14.5.14
flags: [generated]
info: |
[...]
21. For each ClassElement m in order from methods
@ -26,14 +28,12 @@ var stringSet;
var C = class {
get 'line\
Terminator'
() { return 'get string'; }
Continuation'() { return 'get string'; }
set 'line\
Terminator'
(param) { stringSet = param; }
Continuation'(param) { stringSet = param; }
};
assert.sameValue(C.prototype['lineTerminator'], 'get string');
assert.sameValue(C.prototype['lineContinuation'], 'get string');
C.prototype['lineTerminator'] = 'set string';
C.prototype['lineContinuation'] = 'set string';
assert.sameValue(stringSet, 'set string');

View File

@ -1,9 +1,11 @@
// Copyright (C) 2017 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
// This file was procedurally generated from the following sources:
// - src/accessor-names/literal-string-line-continuation.case
// - src/accessor-names/default/cls-expr-static.template
/*---
description: Computed values as accessor property names (string literal containing a line terminator) (Class expression, static method)
description: Computed values as accessor property names (string literal containing LineContinuation) (Class expression, static method)
esid: sec-runtime-semantics-classdefinitionevaluation
es6id: 14.5.14
flags: [generated]
info: |
[...]
21. For each ClassElement m in order from methods
@ -28,14 +30,12 @@ var stringSet;
var C = class {
static get 'line\
Terminator'
() { return 'get string'; }
Continuation'() { return 'get string'; }
static set 'line\
Terminator'
(param) { stringSet = param; }
Continuation'(param) { stringSet = param; }
};
assert.sameValue(C['lineTerminator'], 'get string');
assert.sameValue(C['lineContinuation'], 'get string');
C['lineTerminator'] = 'set string';
C['lineContinuation'] = 'set string';
assert.sameValue(stringSet, 'set string');

View File

@ -1,9 +1,11 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
// This file was procedurally generated from the following sources:
// - src/accessor-names/literal-string-line-continuation.case
// - src/accessor-names/default/obj.template
/*---
description: Computed values as accessor property names (string literal containing a line terminator) (Object initializer)
description: Computed values as accessor property names (string literal containing LineContinuation) (Object initializer)
esid: sec-object-initializer-runtime-semantics-evaluation
es6id: 12.2.6.8
flags: [generated]
info: |
ObjectLiteral :
{ PropertyDefinitionList }
@ -27,14 +29,12 @@ info: |
var stringSet;
var obj = {
get ['line\
Terminator'
]() { return 'get string'; },
Continuation']() { return 'get string'; },
set ['line\
Terminator'
](param) { stringSet = param; }
Continuation'](param) { stringSet = param; }
};
assert.sameValue(obj['lineTerminator'], 'get string');
assert.sameValue(obj['lineContinuation'], 'get string');
obj['lineTerminator'] = 'set string';
obj['lineContinuation'] = 'set string';
assert.sameValue(stringSet, 'set string');

View File

@ -1,9 +1,11 @@
// Copyright (C) 2017 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
// This file was procedurally generated from the following sources:
// - src/accessor-names/literal-string-line-continuation.case
// - src/accessor-names/default/cls-decl-inst.template
/*---
description: Computed values as accessor property names (string literal containing a line terminator) (Class declaration, instance method)
description: Computed values as accessor property names (string literal containing LineContinuation) (Class declaration, instance method)
esid: sec-runtime-semantics-classdefinitionevaluation
es6id: 14.5.14
flags: [generated]
info: |
[...]
21. For each ClassElement m in order from methods
@ -26,14 +28,12 @@ var stringSet;
class C {
get 'line\
Terminator'
() { return 'get string'; }
Continuation'() { return 'get string'; }
set 'line\
Terminator'
(param) { stringSet = param; }
Continuation'(param) { stringSet = param; }
}
assert.sameValue(C.prototype['lineTerminator'], 'get string');
assert.sameValue(C.prototype['lineContinuation'], 'get string');
C.prototype['lineTerminator'] = 'set string';
C.prototype['lineContinuation'] = 'set string';
assert.sameValue(stringSet, 'set string');

View File

@ -1,9 +1,11 @@
// Copyright (C) 2017 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
// This file was procedurally generated from the following sources:
// - src/accessor-names/literal-string-line-continuation.case
// - src/accessor-names/default/cls-decl-static.template
/*---
description: Computed values as accessor property names (string literal containing a line terminator) (Class declaration, static method)
description: Computed values as accessor property names (string literal containing LineContinuation) (Class declaration, static method)
esid: sec-runtime-semantics-classdefinitionevaluation
es6id: 14.5.14
flags: [generated]
info: |
[...]
21. For each ClassElement m in order from methods
@ -28,14 +30,12 @@ var stringSet;
class C {
static get 'line\
Terminator'
() { return 'get string'; }
Continuation'() { return 'get string'; }
static set 'line\
Terminator'
(param) { stringSet = param; }
Continuation'(param) { stringSet = param; }
}
assert.sameValue(C['lineTerminator'], 'get string');
assert.sameValue(C['lineContinuation'], 'get string');
C['lineTerminator'] = 'set string';
C['lineContinuation'] = 'set string';
assert.sameValue(stringSet, 'set string');