Merge pull request #316 from bocoup/template-more

Improve tests for templates
This commit is contained in:
Brian Terlson 2015-07-06 17:30:34 -05:00
commit 6f22dad152
71 changed files with 956 additions and 287 deletions

View File

@ -2,7 +2,8 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8
description: >
description: Template caching using distinct expressions within `eval`
info: >
Previously-created template objects should be retrieved from the internal
template registry when their source is identical but their expressions
evaluate to different values and the tagged template is being evaluated in

View File

@ -2,7 +2,8 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8
description: >
description: Template caching using distinct expressions within `new Function`
info: >
Previously-created template objects should be retrieved from the internal
template registry when their source is identical but their expressions
evaluate to different values and the tagged template is being evaluated in

View File

@ -2,7 +2,8 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8
description: >
description: Template caching using distinct expressions
info: >
Previously-created template objects should be retrieved from the internal
template registry when their source is identical but their expressions
evaluate to different values.

View File

@ -2,7 +2,8 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8
description: >
description: Templates are cached according to their "raw" representation
info: >
The internal template registry should be queried according to the "raw"
strings of the tagged template.
---*/

View File

@ -2,7 +2,8 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8
description: >
description: Templates are cached according to the number of "raw" strings
info: >
The internal template registry should be queried according to the number of
"raw" strings in the tagged template.
---*/

View File

@ -2,7 +2,8 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8
description: >
description: Template caching using identical expressions within `eval`
info: >
Previously-created template objects should be retrieved from the internal
template registry when their source is identical and the tagged template is
being evaluated in an `eval` context.

View File

@ -2,7 +2,8 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8
description: >
description: Template caching using identical expressions within `new Function`
info: >
Previously-created template objects should be retrieved from the internal
template registry when their source is identical and the tagged template is
being evaluated in a `new Function` context.

View File

@ -2,7 +2,8 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8
description: >
description: Template caching using identical expressions
info: >
Previously-created template objects should be retrieved from the internal
template registry when their source is identical.
---*/

View File

@ -0,0 +1,42 @@
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.3.7
description: Argument list evalution for call expresions
info: >
A tagged template is a function call where the arguments of the call are
derived from a TemplateLiteral. The actual arguments include a template
object and the values produced by evaluating the expressions embedded
within the TemplateLiteral.
---*/
var number = 5;
var string = 'str';
var object = {};
function fn() { return 'result'; }
var calls;
calls = 0;
(function() {
return function() {
calls++;
assert.sameValue(
arguments.length, 1, 'NoSubstitutionTemplate arguments length'
);
};
})()`NoSubstitutionTemplate`;
assert.sameValue(calls, 1, 'NoSubstitutionTemplate function invocation');
calls = 0;
(function() {
return function(site, n, s, o, f, r) {
calls++;
assert.sameValue(n, number);
assert.sameValue(s, string);
assert.sameValue(o, object);
assert.sameValue(f, fn);
assert.sameValue(r, 'result');
assert.sameValue(arguments.length, 6, 'TemplateHead arguments length');
};
})()`TemplateHead${number}TemplateSpans${string}${object}${fn}${fn()}`;
assert.sameValue(calls, 1, 'TemplateHead function invocation');

View File

@ -0,0 +1,31 @@
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.3.7
description: Invocation context for call expressions
info: >
A tagged template is a function call where the arguments of the call are
derived from a TemplateLiteral. The actual arguments include a template
object and the values produced by evaluating the expressions embedded
within the TemplateLiteral.
flags: [noStrict]
---*/
var context = null;
var fn = function() {
return function() {
context = this;
};
};
fn()`NoSubstitutionTemplate`;
assert.sameValue(context, this);
fn = function() {
return () => { context = this; };
};
context = null;
fn()`NoSubstitutionTemplate`;
assert.sameValue(context, this);

View File

@ -0,0 +1,31 @@
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.3.7
description: Invocation context for call expressions
info: >
A tagged template is a function call where the arguments of the call are
derived from a TemplateLiteral. The actual arguments include a template
object and the values produced by evaluating the expressions embedded
within the TemplateLiteral.
flags: [onlyStrict]
---*/
var context = null;
var fn = function() {
return function() {
context = this;
};
};
fn()`NoSubstitutionTemplate`;
assert.sameValue(context, undefined);
fn = function() {
return () => { context = this; };
};
context = null;
fn()`NoSubstitutionTemplate`;
assert.sameValue(context, undefined);

View File

@ -2,7 +2,8 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.3.7
description: >
description: Argument list evalution for member expresions
info: >
A tagged template is a function call where the arguments of the call are
derived from a TemplateLiteral. The actual arguments include a template
object and the values produced by evaluating the expressions embedded

View File

@ -2,7 +2,8 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.3.7
description: >
description: Invocation context for member expressions
info: >
A tagged template is a function call where the arguments of the call are
derived from a TemplateLiteral. The actual arguments include a template
object and the values produced by evaluating the expressions embedded

View File

@ -2,7 +2,8 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.3.7
description: >
description: Template objects are frozen (as demonstrated outside of strict mode)
info: >
The first argument to a tagged template should be frozen and define a `raw`
property that is also frozen.
flags: [noStrict]

View File

@ -2,7 +2,8 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.3.7
description: >
description: Template objects are frozen (as demonstrated within strict mode)
info: >
The first argument to a tagged template should be frozen and define a `raw`
property that is also frozen.
flags: [onlyStrict]

View File

@ -2,7 +2,8 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.3.7
description: >
description: Properties of the template object
info: >
The first argument to a tagged template should be a template object as
defined by the GetTemplateObject abstract operation.
includes: [propertyHelper.js]

View File

@ -2,8 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8
description: >
Expressions should be evaluated in left-to-right order.
description: Expressions should be evaluated in left-to-right order.
---*/
var tag = function(templateObject, a, b, c) {

View File

@ -1,11 +1,12 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 11.8.6
description: >
es6id: 11.8.6.1
description: Invalid hexidecimal character escape sequence
info: >
The TV of TemplateCharacter :: \ EscapeSequence is the SV of
EscapeSequence.
negative: SyntaxError
---*/
(function() {})`\x`;
`\x0`;

View File

@ -2,10 +2,11 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 16.1
description: >
description: Invalid octal escape sequence
info: >
TemplateCharacter (11.8.6) must not be extended to include
LegacyOctalEscapeSequence as defined in B.1.2.
negative: SyntaxError
---*/
(function() {})`\00`;
`\00`;

View File

@ -2,10 +2,11 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 11.8.6
description: >
description: Invalid unicode escape sequence
info: >
The TV of TemplateCharacter :: \ EscapeSequence is the SV of
EscapeSequence.
negative: SyntaxError
---*/
(function() {})`\u`;
`\u0`;

View File

@ -0,0 +1,17 @@
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: Abrupt completion when evaluating expression of TemplateLiteral
info: >
TemplateLiteral : TemplateHead Expression TemplateSpans
1. Let head be the TV of TemplateHead as defined in 11.8.6.
2. Let sub be the result of evaluating Expression.
3. Let middle be ToString(sub).
4. ReturnIfAbrupt(middle).
---*/
assert.throws(Test262Error, function() {
`${function() { throw new Test262Error(); }()}`;
});

View File

@ -0,0 +1,16 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: Function invocation in expression position of TemplateLiteral
info: >
TemplateLiteral : TemplateHead Expression TemplateSpans
1. Let head be the TV of TemplateHead as defined in 11.8.6.
2. Let sub be the result of evaluating Expression.
3. Let middle be ToString(sub).
---*/
function fn() { return 'result'; }
assert.sameValue(`foo ${fn()} bar`, 'foo result bar');

View File

@ -0,0 +1,34 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: MemberExpression in expression position of TemplateLiteral
info: >
TemplateLiteral : TemplateHead Expression TemplateSpans
1. Let head be the TV of TemplateHead as defined in 11.8.6.
2. Let sub be the result of evaluating Expression.
3. Let middle be ToString(sub).
---*/
var object = {
number: 5,
string: 'stringValue'
};
assert.sameValue(
`foo ${object.number} bar`, 'foo 5 bar', 'number value property'
);
assert.sameValue(
`foo ${object.string} bar`, 'foo stringValue bar', 'string value property'
);
assert.sameValue(
`foo ${object['string']} bar`,
'foo stringValue bar',
'string value property (single-quote string dereference)'
);
assert.sameValue(
`foo ${object["string"]} bar`,
'foo stringValue bar',
'string value property (double-quote string dereference)'
);

View File

@ -0,0 +1,17 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: Method invocation in expression position of TemplateLiteral
info: >
TemplateLiteral : TemplateHead Expression TemplateSpans
1. Let head be the TV of TemplateHead as defined in 11.8.6.
2. Let sub be the result of evaluating Expression.
3. Let middle be ToString(sub).
---*/
var object = {
fn: function() { return 'result'; }
};
assert.sameValue(`foo ${object.fn()} bar`, 'foo result bar');

View File

@ -1,11 +1,16 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8
description: >
Expressions should be evaluated and converted to Strings according to the
ToString abstract operation.
es6id: 12.2.8.5
description: Object reference in expression position of TemplateLiteral
info: >
TemplateLiteral : TemplateHead Expression TemplateSpans
1. Let head be the TV of TemplateHead as defined in 11.8.6.
2. Let sub be the result of evaluating Expression.
3. Let middle be ToString(sub).
---*/
var plain = {};
var custom = {
toString: function() {

View File

@ -0,0 +1,15 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: Primitive value in expression position of TemplateLiteral
info: >
TemplateLiteral : TemplateHead Expression TemplateSpans
1. Let head be the TV of TemplateHead as defined in 11.8.6.
2. Let sub be the result of evaluating Expression.
3. Let middle be ToString(sub).
---*/
assert.sameValue(`foo ${5} bar`, 'foo 5 bar', 'number value');
assert.sameValue(`foo ${'string'} bar`, 'foo string bar', 'string value');

View File

@ -0,0 +1,14 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: Template literal in expression position of TemplateLiteral
info: >
TemplateLiteral : TemplateHead Expression TemplateSpans
1. Let head be the TV of TemplateHead as defined in 11.8.6.
2. Let sub be the result of evaluating Expression.
3. Let middle be ToString(sub).
---*/
assert.sameValue(`foo ${`bar ${5} baz`} qux`, 'foo bar 5 baz qux');

View File

@ -0,0 +1,23 @@
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: Abrupt completion when converting expression value of TemplateLiteral
info: >
TemplateLiteral : TemplateHead Expression TemplateSpans
1. Let head be the TV of TemplateHead as defined in 11.8.6.
2. Let sub be the result of evaluating Expression.
3. Let middle be ToString(sub).
4. ReturnIfAbrupt(middle).
---*/
var obj = {
toString: function() {
throw new Test262Error();
}
};
assert.throws(Test262Error, function() {
`${obj}`;
});

View File

@ -0,0 +1,19 @@
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: Abrupt completion when evaluating expression of TemplateMiddleList
info: >
TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression
1. Let rest be the result of evaluating TemplateMiddleList .
2. ReturnIfAbrupt(rest).
3. Let middle be the TV of TemplateMiddle as defined in 11.8.6.
4. Let sub be the result of evaluating Expression.
5. Let last be ToString(sub).
6. ReturnIfAbrupt(last).
---*/
assert.throws(Test262Error, function() {
`${0}${1}${function() { throw new Test262Error(); }()}`;
});

View File

@ -0,0 +1,18 @@
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: Function invocation in expression position of TemplateMiddleList
info: >
TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression
1. Let rest be the result of evaluating TemplateMiddleList .
2. ReturnIfAbrupt(rest).
3. Let middle be the TV of TemplateMiddle as defined in 11.8.6.
4. Let sub be the result of evaluating Expression.
5. Let last be ToString(sub).
---*/
function fn() { return 'result'; }
assert.sameValue(`${0} ${1} ${fn()}`, '0 1 result');

View File

@ -0,0 +1,38 @@
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: MemberExpression in expression position of TemplateMiddleList
info: >
TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression
1. Let rest be the result of evaluating TemplateMiddleList .
2. ReturnIfAbrupt(rest).
3. Let middle be the TV of TemplateMiddle as defined in 11.8.6.
4. Let sub be the result of evaluating Expression.
5. Let last be ToString(sub).
---*/
var object = {
number: 5,
string: 'stringValue'
};
assert.sameValue(
`${0} ${1} ${object.number} bar`, '0 1 5 bar', 'number value property'
);
assert.sameValue(
`${0} ${1} ${object.string} bar`,
'0 1 stringValue bar',
'string value property'
);
assert.sameValue(
`${0} ${1} ${object['string']} bar`,
'0 1 stringValue bar',
'string value property (single-quote string dereference)'
);
assert.sameValue(
`${0} ${1} ${object["string"]} bar`,
'0 1 stringValue bar',
'string value property (double-quote string dereference)'
);

View File

@ -0,0 +1,19 @@
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: Method invocation in expression position of TemplateMiddleList
info: >
TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression
1. Let rest be the result of evaluating TemplateMiddleList .
2. ReturnIfAbrupt(rest).
3. Let middle be the TV of TemplateMiddle as defined in 11.8.6.
4. Let sub be the result of evaluating Expression.
5. Let last be ToString(sub).
---*/
var object = {
fn: function() { return 'result'; }
};
assert.sameValue(`${0} ${1} ${object.fn()} bar`, '0 1 result bar');

View File

@ -0,0 +1,31 @@
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: Object reference in expression position of TemplateMiddleList
info: >
TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression
1. Let rest be the result of evaluating TemplateMiddleList .
2. ReturnIfAbrupt(rest).
3. Let middle be the TV of TemplateMiddle as defined in 11.8.6.
4. Let sub be the result of evaluating Expression.
5. Let last be ToString(sub).
---*/
var plain = {};
var custom = {
toString: function() {
return '"own" toString';
}
};
assert.sameValue(`${0} ${1} ${plain}`, '0 1 [object Object]');
assert.sameValue(`${0} ${1} ${plain}`, '0 1 [object Object]');
assert.sameValue(`${0} ${1} ${plain}2`, '0 1 [object Object]2');
assert.sameValue(`${0} ${1} ${plain}2`, '0 1 [object Object]2');
assert.sameValue(`${0} ${1} ${custom}`, '0 1 "own" toString');
assert.sameValue(`${0} ${1} ${custom}`, '0 1 "own" toString');
assert.sameValue(`${0} ${1} ${custom}2`, '0 1 "own" toString2');
assert.sameValue(`${0} ${1} ${custom}2`, '0 1 "own" toString2');

View File

@ -0,0 +1,17 @@
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: Primitive value in expression position of TemplateMiddleList
info: >
TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression
1. Let rest be the result of evaluating TemplateMiddleList .
2. ReturnIfAbrupt(rest).
3. Let middle be the TV of TemplateMiddle as defined in 11.8.6.
4. Let sub be the result of evaluating Expression.
5. Let last be ToString(sub).
---*/
assert.sameValue(`${0} ${1} ${5} bar`, '0 1 5 bar', 'number value');
assert.sameValue(`${0} ${1} ${'string'} bar`, '0 1 string bar', 'string value');

View File

@ -0,0 +1,16 @@
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: Template literal in expression position of TemplateMiddleList
info: >
TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression
1. Let rest be the result of evaluating TemplateMiddleList .
2. ReturnIfAbrupt(rest).
3. Let middle be the TV of TemplateMiddle as defined in 11.8.6.
4. Let sub be the result of evaluating Expression.
5. Let last be ToString(sub).
---*/
assert.sameValue(`${0} ${1} ${`bar ${5} baz`} qux`, '0 1 bar 5 baz qux');

View File

@ -0,0 +1,25 @@
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: Abrupt completion when converting expression value of TemplateMiddleList
info: >
TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression
1. Let rest be the result of evaluating TemplateMiddleList .
2. ReturnIfAbrupt(rest).
3. Let middle be the TV of TemplateMiddle as defined in 11.8.6.
4. Let sub be the result of evaluating Expression.
5. Let last be ToString(sub).
6. ReturnIfAbrupt(last).
---*/
var obj = {
toString: function() {
throw new Test262Error();
}
};
assert.throws(Test262Error, function() {
`${0} ${1} ${obj}`;
});

View File

@ -0,0 +1,17 @@
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: Abrupt completion when evaluating expression of TemplateMiddleList
info: >
TemplateMiddleList : TemplateMiddle Expression
1. Let head be the TV of TemplateMiddle as defined in 11.8.6.
2. Let sub be the result of evaluating Expression.
3. Let middle be ToString(sub).
4. ReturnIfAbrupt(middle).
---*/
assert.throws(Test262Error, function() {
`${0}${function() { throw new Test262Error(); }()}`;
});

View File

@ -0,0 +1,16 @@
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: Function invocation in expression position of TemplateMiddleList
info: >
TemplateMiddleList : TemplateMiddle Expression
1. Let head be the TV of TemplateMiddle as defined in 11.8.6.
2. Let sub be the result of evaluating Expression.
3. Let middle be ToString(sub).
---*/
function fn() { return 'result'; }
assert.sameValue(`${0} ${fn()}`, '0 result');

View File

@ -0,0 +1,35 @@
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: MemberExpression in expression position of TemplateMiddleList
info: >
TemplateMiddleList : TemplateMiddle Expression
1. Let head be the TV of TemplateMiddle as defined in 11.8.6.
2. Let sub be the result of evaluating Expression.
3. Let middle be ToString(sub).
4. ReturnIfAbrupt(middle).
---*/
var object = {
number: 5,
string: 'stringValue'
};
assert.sameValue(
`${0} ${object.number} bar`, '0 5 bar', 'number value property'
);
assert.sameValue(
`${0} ${object.string} bar`, '0 stringValue bar', 'string value property'
);
assert.sameValue(
`${0} ${object['string']} bar`,
'0 stringValue bar',
'string value property (single-quote string dereference)'
);
assert.sameValue(
`${0} ${object["string"]} bar`,
'0 stringValue bar',
'string value property (double-quote string dereference)'
);

View File

@ -0,0 +1,18 @@
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: Method invocation in expression position of TemplateMiddleList
info: >
TemplateMiddleList : TemplateMiddle Expression
1. Let head be the TV of TemplateMiddle as defined in 11.8.6.
2. Let sub be the result of evaluating Expression.
3. Let middle be ToString(sub).
4. ReturnIfAbrupt(middle).
---*/
var object = {
fn: function() { return 'result'; }
};
assert.sameValue(`${0} ${object.fn()} bar`, '0 result bar');

View File

@ -0,0 +1,30 @@
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: Object reference in expression position of TemplateMiddleList
info: >
TemplateMiddleList : TemplateMiddle Expression
1. Let head be the TV of TemplateMiddle as defined in 11.8.6.
2. Let sub be the result of evaluating Expression.
3. Let middle be ToString(sub).
4. ReturnIfAbrupt(middle).
---*/
var plain = {};
var custom = {
toString: function() {
return '"own" toString';
}
};
assert.sameValue(`${0} ${plain}`, '0 [object Object]');
assert.sameValue(`${0} ${plain}`, '0 [object Object]');
assert.sameValue(`${0} ${plain}2`, '0 [object Object]2');
assert.sameValue(`${0} ${plain}2`, '0 [object Object]2');
assert.sameValue(`${0} ${custom}`, '0 "own" toString');
assert.sameValue(`${0} ${custom}`, '0 "own" toString');
assert.sameValue(`${0} ${custom}2`, '0 "own" toString2');
assert.sameValue(`${0} ${custom}2`, '0 "own" toString2');

View File

@ -0,0 +1,15 @@
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: Primitive value in expression position of TemplateMiddleList
info: >
TemplateMiddleList : TemplateMiddle Expression
1. Let head be the TV of TemplateMiddle as defined in 11.8.6.
2. Let sub be the result of evaluating Expression.
3. Let middle be ToString(sub).
---*/
assert.sameValue(`${0} ${5} bar`, '0 5 bar', 'number value');
assert.sameValue(`${0} ${'string'} bar`, '0 string bar', 'string value');

View File

@ -0,0 +1,14 @@
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: Template literal in expression position of TemplateMiddleList
info: >
TemplateMiddleList : TemplateMiddle Expression
1. Let head be the TV of TemplateMiddle as defined in 11.8.6.
2. Let sub be the result of evaluating Expression.
3. Let middle be ToString(sub).
---*/
assert.sameValue(`${0} ${`bar ${5} baz`} qux`, '0 bar 5 baz qux');

View File

@ -0,0 +1,23 @@
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: Abrupt completion when converting expression value of TemplateMiddleList
info: >
TemplateMiddleList : TemplateMiddle Expression
1. Let head be the TV of TemplateMiddle as defined in 11.8.6.
2. Let sub be the result of evaluating Expression.
3. Let middle be ToString(sub).
4. ReturnIfAbrupt(middle).
---*/
var obj = {
toString: function() {
throw new Test262Error();
}
};
assert.throws(Test262Error, function() {
`${0} ${obj}`;
});

View File

@ -0,0 +1,14 @@
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8.5
description: Evaluation of NoSubstitutionTemplate
info: >
12.2.8.5 Runtime Semantics: Evaluation
TemplateLiteral : NoSubstitutionTemplate
1. Return the string value whose code units are the elements of the TV of
NoSubstitutionTemplate as defined in 11.8.6.
---*/
assert.sameValue(`NoSubstitutionTemplate`, 'NoSubstitutionTemplate');

View File

@ -0,0 +1,117 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 11.8.6.1
description: Template values of character escape sequences
info: >
The TV of TemplateCharacter :: \ EscapeSequence is the SV of
EscapeSequence.
The TRV of TemplateCharacter :: \ EscapeSequence is the sequence consisting
of the code unit value 0x005C followed by the code units of TRV of
EscapeSequence.
The TRV of CharacterEscapeSequence :: SingleEscapeCharacter is the TRV of
the SingleEscapeCharacter.
The TRV of CharacterEscapeSequence :: NonEscapeCharacter is the SV of the
NonEscapeCharacter.
---*/
var calls;
calls = 0;
(function(s) {
calls++;
assert.sameValue(s[0], "'", "TV of NonEscapeCharacter");
assert.sameValue(s.raw[0], "\u005C\u0027", "TRV of NonEscapeCharacter");
})`\'`;
assert.sameValue(calls, 1);
calls = 0;
(function(s) {
calls++;
assert.sameValue(s[0], "\"", "TV of SingleEscapeCharacter (double quote)");
assert.sameValue(
s.raw[0], "\u005C\u0022", "TRV of SingleEscapeCharacter (double quote)"
);
})`\"`;
assert.sameValue(calls, 1);
calls = 0;
(function(s) {
calls++;
assert.sameValue(s[0], "\\", "TV of SingleEscapeCharacter (backslash)");
assert.sameValue(
s.raw[0], "\u005C\u005C", "TRV of SingleEscapeCharacter (backslash)"
);
})`\\`;
assert.sameValue(calls, 1);
calls = 0;
(function(s) {
calls++;
assert.sameValue(s[0], "\b", "TV of SingleEscapeCharacter (backspace)");
assert.sameValue(
s.raw[0], "\u005Cb", "TRV of SingleEscapeCharacter (backspace)"
);
})`\b`;
assert.sameValue(calls, 1);
calls = 0;
(function(s) {
calls++;
assert.sameValue(s[0], "\f", "TV of SingleEscapeCharacter (form feed)");
assert.sameValue(
s.raw[0], "\u005Cf", "TRV of SingleEscapeCharacter (form feed)"
);
})`\f`;
assert.sameValue(calls, 1);
calls = 0;
(function(s) {
calls++;
assert.sameValue(s[0], "\n", "TV of SingleEscapeCharacter (new line)");
assert.sameValue(
s.raw[0], "\u005Cn", "TRV of SingleEscapeCharacter (new line)"
);
})`\n`;
assert.sameValue(calls, 1);
calls = 0;
(function(s) {
calls++;
assert.sameValue(
s[0], "\r", "TV of SingleEscapeCharacter (carriage return)"
);
assert.sameValue(
s.raw[0], "\u005Cr", "TRV of SingleEscapeCharacter (carriage return)"
);
})`\r`;
assert.sameValue(calls, 1);
calls = 0;
(function(s) {
calls++;
assert.sameValue(s[0], " ", "TV of SingleEscapeCharacter (tab)");
assert.sameValue(s.raw[0], "\u005Ct", "TRV of SingleEscapeCharacter (tab)");
})`\t`;
assert.sameValue(calls, 1);
calls = 0;
(function(s) {
calls++;
assert.sameValue(
s[0], "\v", "TV of SingleEscapeCharacter (line tabulation)"
);
assert.sameValue(
s.raw[0], "\u005Cv", "TRV of SingleEscapeCharacter (line tabulation)"
);
})`\v`;
assert.sameValue(calls, 1);
calls = 0;
(function(s) {
calls++;
assert.sameValue(s[0], "`", "TV of SingleEscapeCharacter (backtick)");
assert.sameValue(
s.raw[0], "\u005C`", "TRV of SingleEscapeCharacter (backtick)"
);
})`\``;
assert.sameValue(calls, 1);

View File

@ -1,8 +1,11 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 11.1
description: >
es6id: 11.8.6.1
description: Template values of hex escape sequences
info: >
The TV of TemplateCharacter :: \ EscapeSequence is the SV of
EscapeSequence.
The SV of UnicodeEscapeSequence :: u{ HexDigits } is the UTF16Encoding
(10.1.1) of the MV of HexDigits.
The TRV of UnicodeEscapeSequence :: u{ HexDigits } is the sequence
@ -15,15 +18,7 @@ var calls;
calls = 0;
(function(s) {
calls++;
assert.sameValue(s[0], 'abc', '`` sequence template value');
assert.sameValue(s.raw[0], 'a\\u{62}c', '`` sequence template raw value');
})`a\u{62}c`;
assert.sameValue(calls, 1);
calls = 0;
(function(s) {
calls++;
assert.sameValue(s[0], 'abc', 'HexEscapeSequence template value');
assert.sameValue(s.raw[0], 'a\\u{000062}c', 'HexEscapeSequence template raw value');
})`a\u{000062}c`;
assert.sameValue(s[0], 'A', 'TV');
assert.sameValue(s.raw[0], '\\x41', 'TRV');
})`\x41`;
assert.sameValue(calls, 1);

View File

@ -1,17 +1,22 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 11.8.6
description: >
es6id: 11.8.6.1
description: Template values of line continuations
info: >
The TV of LineContinuation :: \ LineTerminatorSequence is the empty code
unit sequence.
The TRV of LineContinuation :: \ LineTerminatorSequence is the sequence
consisting of the code unit value 0x005C followed by the code units of TRV
of LineTerminatorSequence.
---*/
var calls;
calls = 0;
(function(cs) {
calls++;
assert.sameValue(cs[0], '', 'Line Feed and Carriage Return');
assert.sameValue(
cs.raw[0], '\u005C\n\u005C\n\u005C\n', 'Line Feed and Carriage Return'
);
@ -23,6 +28,7 @@ assert.sameValue(calls, 1);
calls = 0;
(function(cs) {
calls++;
assert.sameValue(cs[0], '', 'Line Separator');
assert.sameValue(cs.raw[0], '\\\u2028', 'Line Separator');
})`\`
assert.sameValue(calls, 1);
@ -30,6 +36,7 @@ assert.sameValue(calls, 1);
calls = 0;
(function(cs) {
calls++;
assert.sameValue(cs[0], '', 'Paragraph Separater');
assert.sameValue(cs.raw[0], '\\\u2029', 'Paragraph Separator');
})`\`
assert.sameValue(calls, 1);

View File

@ -1,8 +1,11 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 11.8.6
description: >
es6id: 11.8.6.1
description: Template values of line terminator sequences
info: >
The TV of TemplateCharacter :: LineTerminatorSequence is the TRV of
LineTerminatorSequence.
The TRV of LineTerminatorSequence :: <LF> is the code unit value 0x000A.
The TRV of LineTerminatorSequence :: <CR> is the code unit value 0x000A.
The TRV of LineTerminatorSequence :: <LS> is the code unit value 0x2028.
@ -10,11 +13,14 @@ description: >
The TRV of LineTerminatorSequence :: <CR><LF> is the sequence consisting of
the code unit value 0x000A.
---*/
var calls;
calls = 0;
(function(s) {
calls++;
assert.sameValue(s[0], '\n\n\n', 'Line Feed and Carriage Return');
assert.sameValue(s.raw[0], '\n\n\n', 'Line Feed and Carriage Return');
})`
@ -24,6 +30,7 @@ assert.sameValue(calls, 1);
calls = 0;
(function(cs) {
calls++;
assert.sameValue(cs[0], '\u2028', 'Line Separator');
assert.sameValue(cs.raw[0], '\u2028', 'Line Separator');
})``
assert.sameValue(calls, 1);
@ -31,6 +38,7 @@ assert.sameValue(calls, 1);
calls = 0;
(function(cs) {
calls++;
assert.sameValue(cs[0], '\u2029', 'Paragraph Separator');
assert.sameValue(cs.raw[0], '\u2029', 'Paragraph Separator');
})``
assert.sameValue(calls, 1);

View File

@ -1,12 +1,15 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 11.8.6
description: >
es6id: 11.8.6.1
description: Template values of templates without substitution patterns
info: >
The TV and TRV of NoSubstitutionTemplate :: `` is the empty code unit
sequence.
The TV of NoSubstitutionTemplate :: ` TemplateCharacters ` is the TV of
TemplateCharacters.
The TRV of NoSubstitutionTemplate :: ` TemplateCharacters ` is the TRV of
TemplateCharacters.
---*/
var calls;
@ -23,5 +26,6 @@ calls = 0;
(function(s) {
calls++;
assert.sameValue(s[0], 'foo', 'Template value (with content)');
assert.sameValue(s.raw[0], 'foo', 'Template raw value (with content)');
})`foo`;
assert.sameValue(calls, 1);

View File

@ -0,0 +1,38 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 11.8.6.1
description: Template values of single characters
info: >
The TV of TemplateCharacters :: TemplateCharacter is the TV of
TemplateCharacter.
The TV of TemplateCharacter :: SourceCharacter but not one of ` or \ or $
or LineTerminator is the UTF16Encoding (10.1.1) of the code point value of
SourceCharacter.
The TV of TemplateCharacter :: $ is the code unit value 0x0024.
The TRV of TemplateCharacters :: TemplateCharacter is the TRV of
TemplateCharacter.
The TRV of TemplateCharacter :: SourceCharacter but not one of ` or \ or $
or LineTerminator is the UTF16Encoding (10.1.1) of the code point value of
SourceCharacter.
The TRV of TemplateCharacter :: $ is the code unit value 0x0024.
---*/
var calls;
calls = 0;
(function(s) {
calls++;
assert.sameValue(s[0], 'a', '`a` character TV');
assert.sameValue(s.raw[0], 'a', '`a` character TRV');
})`a`;
assert.sameValue(calls, 1);
calls = 0;
(function(s) {
calls++;
assert.sameValue(s[0], '$', '`$` character TV');
assert.sameValue(s.raw[0], '$', '`$` character TRV');
})`$`;
assert.sameValue(calls, 1);

View File

@ -0,0 +1,23 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 11.8.6.1
description: Template values of multiple template characters
info: >
The TV of TemplateCharacters :: TemplateCharacter TemplateCharacters is a
sequence consisting of the code units in the TV of TemplateCharacter
followed by all the code units in the TV of TemplateCharacters in order.
The TRV of TemplateCharacters :: TemplateCharacter TemplateCharacters is a
sequence consisting of the code units in the TRV of TemplateCharacter
followed by all the code units in the TRV of TemplateCharacters, in order.
---*/
var calls = 0;
(function(s) {
calls++;
assert.sameValue(s.raw[0], 'test');
})`test`;
assert.sameValue(calls, 1);
assert.sameValue(`test`, 'test');

View File

@ -1,8 +1,9 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 11.8.6
description: >
es6id: 11.8.6.1
description: Template values of the template head pattern
info: >
The TV and TRV of TemplateHead :: `${ is the empty code unit sequence.
The TV of TemplateHead :: ` TemplateCharacters ${ is the TV of
TemplateCharacters.

View File

@ -1,11 +1,10 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 11.8.6
description: >
es6id: 11.8.6.1
description: Template values of the template middle pattern
info: >
The TV and TRV of TemplateMiddle :: }${ is the empty code unit sequence.
The TV of TemplateMiddle :: } TemplateCharacters ${ is the TV of
TemplateCharacters.
The TRV of TemplateMiddle :: } TemplateCharacters ${ is the TRV of
TemplateCharacters.
---*/

View File

@ -1,8 +1,9 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 11.8.6
description: >
es6id: 11.8.6.1
description: Template values of the template tail pattern
info: >
The TV and TRV of TemplateTail :: }` is the empty code unit sequence.
The TV of TemplateTail :: } TemplateCharacters ` is the TV of
TemplateCharacters.

View File

@ -0,0 +1,50 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 11.8.6.1
description: Template values of UTF-16 escape sequences
info: >
The TV of TemplateCharacter :: \ EscapeSequence is the SV of
EscapeSequence.
The SV of UnicodeEscapeSequence :: u{ HexDigits } is the UTF16Encoding
(10.1.1) of the MV of HexDigits.
The TRV of UnicodeEscapeSequence :: u Hex4Digits is the sequence consisting
of code unit value 0x0075 followed by TRV of Hex4Digits.
The TRV of UnicodeEscapeSequence :: u{ HexDigits } is the sequence
consisting of code unit value 0x0075 followed by code unit value 0x007B
followed by TRV of HexDigits followed by code unit value 0x007D.
---*/
var calls;
calls = 0;
(function(s) {
calls++;
assert.sameValue(s[0], 'b', 'u Hex4Digits template value');
assert.sameValue(s.raw[0], '\\u0062', 'u Hex4Digits template raw value');
})`\u0062`;
assert.sameValue(calls, 1);
calls = 0;
(function(s) {
calls++;
assert.sameValue(s[0], 'b', 'u{ HexDigits } template value');
assert.sameValue(
s.raw[0], '\\u{62}', 'u{ Hex4Digits } template raw value'
);
})`\u{62}`;
assert.sameValue(calls, 1);
calls = 0;
(function(s) {
calls++;
assert.sameValue(
s[0], 'b', 'u{ HexDigits } template value (with leading zeros)'
);
assert.sameValue(
s.raw[0],
'\\u{000062}',
'u{ HexDigits } template raw value (with leading zeros)'
);
})`\u{000062}`;
assert.sameValue(calls, 1);

View File

@ -0,0 +1,33 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 11.1.8.6.1
description: Template values of the zero width no-break space character
info: >
The zero width no-break space format-control character may be used within
template literals.
---*/
var callCount;
callCount = 0;
(function(s) {
callCount++;
assert.sameValue(
s[0], 'test', 'TV (specified via unicode escape sequence)'
);
assert.sameValue(
s.raw[0], '\\uFEFFtest', 'TV (specified via unicode escape sequence)'
);
})`\uFEFFtest`;
assert.sameValue(callCount, 1);
callCount = 0;
(function(s) {
callCount++;
assert.sameValue(s[0], 'test', 'TV (specified via literal character)');
assert.sameValue(
s.raw[0], 'test', 'TV (specified via literal character)'
);
})`test`;
assert.sameValue(callCount, 1);

View File

@ -1,11 +0,0 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8
description: >
Expressions should be evaluated and converted to Strings according to the
ToString abstract operation.
---*/
function fn() { return 'result'; }
assert.sameValue(`foo ${fn()} bar`, 'foo result bar');

View File

@ -1,13 +0,0 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8
description: >
Expressions should be evaluated and converted to Strings according to the
ToString abstract operation.
---*/
var object = {
fn: function() { return 'result'; }
};
assert.sameValue(`foo ${object.fn()} bar`, 'foo result bar');

View File

@ -1,19 +0,0 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8
description: >
Expressions should be evaluated and converted to Strings according to the
ToString abstract operation.
---*/
var object = {
number: 5,
string: 'stringValue'
};
assert.sameValue(
`foo ${object.number} bar`, 'foo 5 bar', 'number value property'
);
assert.sameValue(
`foo ${object.string} bar`, 'foo stringValue bar', 'string value property'
);

View File

@ -1,11 +0,0 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8
description: >
Expressions should be evaluated and converted to Strings according to the
ToString abstract operation.
---*/
assert.sameValue(`foo ${5} bar`, 'foo 5 bar', 'number value');
assert.sameValue(`foo ${'string'} bar`, 'foo string bar', 'string value');

View File

@ -1,9 +0,0 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 12.2.8
description: >
Expressions should be evaluated and converted to Strings according to the
ToString abstract operation.
---*/
assert.sameValue(`foo ${`bar ${5} baz`} qux`, 'foo bar 5 baz qux');

View File

@ -1,88 +0,0 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 11.8.6
description: >
The TRV of CharacterEscapeSequence :: SingleEscapeCharacter is the TRV of
the SingleEscapeCharacter.
The TRV of CharacterEscapeSequence :: NonEscapeCharacter is the CV of the
NonEscapeCharacter.
---*/
var calls;
calls = 0;
(function(s) {
calls++;
assert.sameValue(s.raw[0], "\u005C\u0027");
})`\'`;
assert.sameValue(calls, 1);
calls = 0;
(function(s) {
calls++;
assert.sameValue(s.raw[0], "\u005C\u0022");
})`\"`;
assert.sameValue(calls, 1);
calls = 0;
(function(s) {
calls++;
assert.sameValue(s.raw[0], "\u005C\u005C");
})`\\`;
assert.sameValue(calls, 1);
calls = 0;
(function(s) {
calls++;
assert.sameValue(s.raw[0], "\u005Cb");
})`\b`;
assert.sameValue(calls, 1);
calls = 0;
(function(s) {
calls++;
assert.sameValue(s.raw[0], "\u005Cf");
})`\f`;
assert.sameValue(calls, 1);
calls = 0;
(function(s) {
calls++;
assert.sameValue(s.raw[0], "\u005Cn");
})`\n`;
assert.sameValue(calls, 1);
calls = 0;
(function(s) {
calls++;
assert.sameValue(s.raw[0], "\u005Cr");
})`\r`;
assert.sameValue(calls, 1);
calls = 0;
(function(s) {
calls++;
assert.sameValue(s.raw[0], "\u005Ct");
})`\t`;
assert.sameValue(calls, 1);
calls = 0;
(function(s) {
calls++;
assert.sameValue(s.raw[0], "\u005Cv");
})`\v`;
assert.sameValue(calls, 1);
calls = 0;
(function(s) {
calls++;
assert.sameValue(s.raw[0], "\u005C`");
})`\``;
assert.sameValue(calls, 1);
calls = 0;
(function(s) {
calls++;
assert.sameValue(s.raw[0], "\u005Cz");
})`\z`;
assert.sameValue(calls, 1);

View File

@ -1,13 +0,0 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 11.8.6
description: >
The TV of TemplateCharacter :: \ EscapeSequence is the SV of
EscapeSequence.
---*/
assert.sameValue(`foo
bar
baz`, 'foo\n bar\n baz');
assert.sameValue(eval('`foo\r\n bar\r baz`'), 'foo\n bar\n baz');

View File

@ -1,29 +0,0 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 11.8.6
description: >
The TV of TemplateCharacter :: $ is the code unit value 0x0024.
The TV of TemplateCharacter :: \ EscapeSequence is the CV of
EscapeSequence.
The TV of TemplateCharacter :: LineContinuation is the TV of
LineContinuation. The TV of LineContinuation :: \ LineTerminatorSequence is
the empty code unit sequence.
The TRV of TemplateCharacter :: $ is the code unit value 0x0024.
---*/
var calls;
assert.sameValue(`\uc548\uB155`, "안녕");
assert.sameValue(`\xff`, "\xff");
assert.sameValue(`\n`, "\n");
assert.sameValue(`\
`, '');
calls = 0;
(function(s) {
calls++;
assert.sameValue(s[0], '$', '`$` character template value');
assert.sameValue(s.raw[0], '$', '`$` character template raw value');
})`$`;
assert.sameValue(calls, 1);

View File

@ -1,24 +0,0 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 11.8.6
description: >
The TV of TemplateCharacters :: TemplateCharacter is the TV of
TemplateCharacter.
The TV of NoSubstitutionTemplate :: ` TemplateCharacters ` is the TV of
TemplateCharacters.
The TRV of TemplateCharacters :: TemplateCharacter is the TRV of
TemplateCharacter.
---*/
var calls;
calls = 0;
(function(s) {
calls++;
assert.sameValue(s[0], 'f', 'TemplateCharacters template value');
assert.sameValue(s.raw[0], 'f', 'TemplateCharacters template raw value');
})`f`;
assert.sameValue(calls, 1);
assert.sameValue(`test`, 'test', 'TemplateCharacters template value');

View File

@ -1,15 +0,0 @@
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 11.1
description: >
The zero width no-break space format-control character may be used within
template literals.
---*/
assert.sameValue(
`\uFEFFtest`, 'test', 'Specified via unicode escape sequence'
);
assert.sameValue(
`test`, 'test', 'Specified via literal character'
);