aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitattributes1
-rw-r--r--test/built-ins/String/raw/special-characters.js21
-rw-r--r--test/built-ins/String/raw/zero-literal-segments.js9
-rw-r--r--test/language/templates/expressions/evaluation-order.js25
-rw-r--r--test/language/templates/expressions/function-invocation.js11
-rw-r--r--test/language/templates/expressions/legacy-octal-escape-sequence-non-strict.js13
-rw-r--r--test/language/templates/expressions/legacy-octal-escape-sequence-strict.js14
-rw-r--r--test/language/templates/expressions/method-invocation.js13
-rw-r--r--test/language/templates/expressions/object-deference.js19
-rw-r--r--test/language/templates/expressions/object.js24
-rw-r--r--test/language/templates/expressions/primitives.js11
-rw-r--r--test/language/templates/expressions/template-literal.js9
-rw-r--r--test/language/templates/tagged/caching/differing-expressions-eval.js25
-rw-r--r--test/language/templates/tagged/caching/differing-expressions-new-function.js29
-rw-r--r--test/language/templates/tagged/caching/differing-expressions.js24
-rw-r--r--test/language/templates/tagged/caching/differing-raw-strings.js24
-rw-r--r--test/language/templates/tagged/caching/differing-string-count.js24
-rw-r--r--test/language/templates/tagged/caching/identical-source-eval.js23
-rw-r--r--test/language/templates/tagged/caching/identical-source-new-function.js23
-rw-r--r--test/language/templates/tagged/caching/identical-source.js26
-rw-r--r--test/language/templates/tagged/call-expression-argument-list-evaluation.js38
-rw-r--r--test/language/templates/tagged/chained-application.js20
-rw-r--r--test/language/templates/tagged/constructor-invocation.js27
-rw-r--r--test/language/templates/tagged/member-expression-context.js20
-rw-r--r--test/language/templates/tagged/template-object.js47
-rw-r--r--test/language/templates/template-values/character-escape-sequence.js88
-rw-r--r--test/language/templates/template-values/escape-sequence.jsbin0 -> 1149 bytes
-rw-r--r--test/language/templates/template-values/invalid/hexidecimal-character-escape-sequence-truncated.js11
-rw-r--r--test/language/templates/template-values/invalid/legacy-octal-escape-sequence.js11
-rw-r--r--test/language/templates/template-values/invalid/unicode-escape-sequence-truncated.js11
-rw-r--r--test/language/templates/template-values/line-continuation.js19
-rw-r--r--test/language/templates/template-values/line-terminator-sequence.js20
-rw-r--r--test/language/templates/template-values/multi-line.js13
-rw-r--r--test/language/templates/template-values/no-substitution.js27
-rw-r--r--test/language/templates/template-values/non-escape-character.jsbin0 -> 496 bytes
-rw-r--r--test/language/templates/template-values/null-character-escape-sequence.jsbin0 -> 520 bytes
-rw-r--r--test/language/templates/template-values/template-character.js29
-rw-r--r--test/language/templates/template-values/template-characters.js24
-rw-r--r--test/language/templates/template-values/template-head.js29
-rw-r--r--test/language/templates/template-values/template-middle.js29
-rw-r--r--test/language/templates/template-values/template-tail.js29
-rw-r--r--test/language/templates/template-values/utf16-escape-sequence.js29
-rw-r--r--test/language/templates/template-values/zwnbsp.js15
43 files changed, 904 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 000000000..a35dab0d3
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+*.js diff
diff --git a/test/built-ins/String/raw/special-characters.js b/test/built-ins/String/raw/special-characters.js
new file mode 100644
index 000000000..6c6d4adf7
--- /dev/null
+++ b/test/built-ins/String/raw/special-characters.js
@@ -0,0 +1,21 @@
+// 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: 21.1.2.4
+description: >
+ When used as a tag function of a tagged template, `String.raw` should
+ return the "raw" representation of the template.
+---*/
+
+assert.sameValue(
+ String.raw`\u0065\`\r\r\n\n${'test'}check`,
+ '\\u0065\\`\\r\\r\\n\\ntestcheck',
+ 'Unicode escape sequences'
+);
+assert.sameValue(
+ String.raw`\ \
+\
+`,
+ '\\\n\\\n\\\n',
+ 'Literal characters'
+);
diff --git a/test/built-ins/String/raw/zero-literal-segments.js b/test/built-ins/String/raw/zero-literal-segments.js
new file mode 100644
index 000000000..c66124b2d
--- /dev/null
+++ b/test/built-ins/String/raw/zero-literal-segments.js
@@ -0,0 +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: 21.1.2.4
+description: >
+ If literalSegments ≤ 0, return the empty string.
+---*/
+
+assert.sameValue(String.raw``, '');
diff --git a/test/language/templates/expressions/evaluation-order.js b/test/language/templates/expressions/evaluation-order.js
new file mode 100644
index 000000000..b707f6d2c
--- /dev/null
+++ b/test/language/templates/expressions/evaluation-order.js
@@ -0,0 +1,25 @@
+// 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 in left-to-right order.
+---*/
+
+var tag = function(templateObject, a, b, c) {
+ callCount++;
+ assert.sameValue(a, 0);
+ assert.sameValue(b, 1);
+ assert.sameValue(c, 2);
+};
+var i = 0;
+var callCount;
+
+assert.sameValue(`a${ i++ }b${ i++ }c${ i++ }d`, 'a0b1c2d');
+
+i = 0;
+callCount = 0;
+
+tag`a${ i++ }b${ i++ }c${ i++ }d`;
+
+assert.sameValue(callCount, 1);
diff --git a/test/language/templates/expressions/function-invocation.js b/test/language/templates/expressions/function-invocation.js
new file mode 100644
index 000000000..06235f824
--- /dev/null
+++ b/test/language/templates/expressions/function-invocation.js
@@ -0,0 +1,11 @@
+// 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 Stings accordingto the
+ ToString abstract operation.
+---*/
+function fn() { return 'result'; }
+
+assert.sameValue(`foo ${fn()} bar`, 'foo result bar');
diff --git a/test/language/templates/expressions/legacy-octal-escape-sequence-non-strict.js b/test/language/templates/expressions/legacy-octal-escape-sequence-non-strict.js
new file mode 100644
index 000000000..6822e5874
--- /dev/null
+++ b/test/language/templates/expressions/legacy-octal-escape-sequence-non-strict.js
@@ -0,0 +1,13 @@
+// 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: >
+ The expression within the template should be evaluated according to the
+ semantics of the surrounding context.
+ The SV of EscapeSequence :: HexEscapeSequence is the SV of the
+ HexEscapeSequence.
+flags: [noStrict]
+---*/
+
+assert.sameValue(`${'\07'}`, '');
diff --git a/test/language/templates/expressions/legacy-octal-escape-sequence-strict.js b/test/language/templates/expressions/legacy-octal-escape-sequence-strict.js
new file mode 100644
index 000000000..d2a0467e9
--- /dev/null
+++ b/test/language/templates/expressions/legacy-octal-escape-sequence-strict.js
@@ -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
+description: >
+ The expression within the template should be evaluated according to the
+ semantics of the surrounding context.
+ The SV of EscapeSequence :: HexEscapeSequence is the SV of the
+ HexEscapeSequence.
+negative: SyntaxError
+flags: [onlyStrict]
+---*/
+
+`${'\07'}`;
diff --git a/test/language/templates/expressions/method-invocation.js b/test/language/templates/expressions/method-invocation.js
new file mode 100644
index 000000000..98fe65266
--- /dev/null
+++ b/test/language/templates/expressions/method-invocation.js
@@ -0,0 +1,13 @@
+// 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 Stings accordingto the
+ ToString abstract operation.
+---*/
+var object = {
+ fn: function() { return 'result'; }
+};
+
+assert.sameValue(`foo ${object.fn()} bar`, 'foo result bar');
diff --git a/test/language/templates/expressions/object-deference.js b/test/language/templates/expressions/object-deference.js
new file mode 100644
index 000000000..40e696df3
--- /dev/null
+++ b/test/language/templates/expressions/object-deference.js
@@ -0,0 +1,19 @@
+// 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 Stings accordingto 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'
+);
diff --git a/test/language/templates/expressions/object.js b/test/language/templates/expressions/object.js
new file mode 100644
index 000000000..605f4a0cc
--- /dev/null
+++ b/test/language/templates/expressions/object.js
@@ -0,0 +1,24 @@
+// 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 Stings according to the
+ ToString abstract operation.
+---*/
+var plain = {};
+var custom = {
+ toString: function() {
+ return '"own" toString';
+ }
+};
+
+assert.sameValue(`${plain}`, '[object Object]');
+assert.sameValue(`1${plain}`, '1[object Object]');
+assert.sameValue(`${plain}2`, '[object Object]2');
+assert.sameValue(`1${plain}2`, '1[object Object]2');
+
+assert.sameValue(`${custom}`, '"own" toString');
+assert.sameValue(`1${custom}`, '1"own" toString');
+assert.sameValue(`${custom}2`, '"own" toString2');
+assert.sameValue(`1${custom}2`, '1"own" toString2');
diff --git a/test/language/templates/expressions/primitives.js b/test/language/templates/expressions/primitives.js
new file mode 100644
index 000000000..b5e1b6739
--- /dev/null
+++ b/test/language/templates/expressions/primitives.js
@@ -0,0 +1,11 @@
+// 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 Stings accordingto the
+ ToString abstract operation.
+---*/
+
+assert.sameValue(`foo ${5} bar`, 'foo 5 bar', 'number value');
+assert.sameValue(`foo ${'string'} bar`, 'foo string bar', 'string value');
diff --git a/test/language/templates/expressions/template-literal.js b/test/language/templates/expressions/template-literal.js
new file mode 100644
index 000000000..6e4aca2ec
--- /dev/null
+++ b/test/language/templates/expressions/template-literal.js
@@ -0,0 +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: 12.2.8
+description: >
+ Expressions should be evaluated and converted to Stings accordingto the
+ ToString abstract operation.
+---*/
+assert.sameValue(`foo ${`bar ${5} baz`} qux`, 'foo bar 5 baz qux');
diff --git a/test/language/templates/tagged/caching/differing-expressions-eval.js b/test/language/templates/tagged/caching/differing-expressions-eval.js
new file mode 100644
index 000000000..c233db3b8
--- /dev/null
+++ b/test/language/templates/tagged/caching/differing-expressions-eval.js
@@ -0,0 +1,25 @@
+// 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: >
+ 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
+ an `eval` context.
+---*/
+function tag(templateObject) {
+ previousObject = templateObject;
+}
+var a = 1;
+var b = 2;
+var firstObject = null;
+var previousObject = null;
+
+tag`head${a}tail`;
+firstObject = previousObject;
+assert(firstObject !== null);
+previousObject = null;
+
+eval('tag`head${b}tail`');
+assert.sameValue(previousObject, firstObject);
diff --git a/test/language/templates/tagged/caching/differing-expressions-new-function.js b/test/language/templates/tagged/caching/differing-expressions-new-function.js
new file mode 100644
index 000000000..4fe47eabc
--- /dev/null
+++ b/test/language/templates/tagged/caching/differing-expressions-new-function.js
@@ -0,0 +1,29 @@
+// 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: >
+ 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
+ an `eval` context.
+---*/
+function tag(templateObject) {
+ previousObject = templateObject;
+}
+var a = 1;
+var b = 2;
+var firstObject = null;
+var previousObject = null;
+
+tag`head${a}tail`;
+firstObject = previousObject;
+assert(firstObject !== null);
+previousObject = null;
+
+(new Function('tag', 'a', 'b', 'return tag`head${b}tail`;'))(tag, 1, 2);
+assert.sameValue(
+ previousObject,
+ firstObject,
+ 'The realm\'s template cache is referenced when tagged templates are declared within "new Function" contexts and templated values differ'
+);
diff --git a/test/language/templates/tagged/caching/differing-expressions.js b/test/language/templates/tagged/caching/differing-expressions.js
new file mode 100644
index 000000000..88495e350
--- /dev/null
+++ b/test/language/templates/tagged/caching/differing-expressions.js
@@ -0,0 +1,24 @@
+// 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: >
+ Previously-created template objects should be retrieved from the internal
+ template registry when their source is identical but their expressions
+ evaluate to different values.
+---*/
+function tag(templateObject) {
+ previousObject = templateObject;
+}
+var a = 1;
+var b = 2;
+var firstObject = null;
+var previousObject = null;
+
+tag`head${a}tail`;
+firstObject = previousObject;
+assert(firstObject !== null);
+previousObject = null;
+
+tag`head${b}tail`;
+assert.sameValue(previousObject, firstObject);
diff --git a/test/language/templates/tagged/caching/differing-raw-strings.js b/test/language/templates/tagged/caching/differing-raw-strings.js
new file mode 100644
index 000000000..98bb3568e
--- /dev/null
+++ b/test/language/templates/tagged/caching/differing-raw-strings.js
@@ -0,0 +1,24 @@
+// 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: >
+ The internal template registry should be queried according to the "raw"
+ strings of the tagged template.
+---*/
+var previousObject = null;
+var firstObject = null;
+function tag(templateObject) {
+ previousObject = templateObject;
+}
+
+tag`\uc548\ub155`;
+
+assert(previousObject !== null);
+firstObject = previousObject;
+previousObject = null;
+
+tag`안녕`;
+
+assert(previousObject !== null);
+assert(firstObject !== previousObject);
diff --git a/test/language/templates/tagged/caching/differing-string-count.js b/test/language/templates/tagged/caching/differing-string-count.js
new file mode 100644
index 000000000..30afbe942
--- /dev/null
+++ b/test/language/templates/tagged/caching/differing-string-count.js
@@ -0,0 +1,24 @@
+// 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: >
+ The internal template registry should be queried according to the number of
+ "raw" strings in the tagged template.
+---*/
+var previousObject = null;
+var firstObject = null;
+function tag(templateObject) {
+ previousObject = templateObject;
+}
+
+tag`foo${1}bar`;
+
+assert(previousObject !== null);
+firstObject = previousObject;
+previousObject = null;
+
+tag`foo\${1}bar`;
+
+assert(previousObject !== null);
+assert(firstObject !== previousObject);
diff --git a/test/language/templates/tagged/caching/identical-source-eval.js b/test/language/templates/tagged/caching/identical-source-eval.js
new file mode 100644
index 000000000..a83534482
--- /dev/null
+++ b/test/language/templates/tagged/caching/identical-source-eval.js
@@ -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: 12.2.8
+description: >
+ 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.
+---*/
+function tag(templateObject) {
+ previousObject = templateObject;
+}
+var a = 1;
+var firstObject = null;
+var previousObject = null;
+
+tag`head${a}tail`;
+firstObject = previousObject;
+assert(firstObject !== null);
+previousObject = null;
+
+eval('tag`head${a}tail`');
+assert.sameValue(previousObject, firstObject);
diff --git a/test/language/templates/tagged/caching/identical-source-new-function.js b/test/language/templates/tagged/caching/identical-source-new-function.js
new file mode 100644
index 000000000..f262e55c8
--- /dev/null
+++ b/test/language/templates/tagged/caching/identical-source-new-function.js
@@ -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: 12.2.8
+description: >
+ 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.
+---*/
+function tag(templateObject) {
+ previousObject = templateObject;
+}
+var a = 1;
+var firstObject = null;
+var previousObject = null;
+
+tag`head${a}tail`;
+firstObject = previousObject;
+assert(firstObject !== null);
+previousObject = null;
+
+(new Function('tag', 'a', 'b', 'return tag`head${b}tail`;'))(tag, 1, 2);
+assert.sameValue(previousObject, firstObject);
diff --git a/test/language/templates/tagged/caching/identical-source.js b/test/language/templates/tagged/caching/identical-source.js
new file mode 100644
index 000000000..dc844481f
--- /dev/null
+++ b/test/language/templates/tagged/caching/identical-source.js
@@ -0,0 +1,26 @@
+// 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: >
+ Previously-created template objects should be retrieved from the internal
+ template registry when their source is identical.
+---*/
+function tag(templateObject) {
+ previousObject = templateObject;
+}
+var a = 1;
+var firstObject = null;
+var previousObject = null;
+
+tag`head${a}tail`;
+firstObject = previousObject;
+assert(firstObject !== null);
+previousObject = null;
+
+tag`head${a}tail`;
+assert.sameValue(
+ previousObject,
+ firstObject,
+ 'The realm\'s template cache is used when tagged templates are executed in the source code directly'
+);
diff --git a/test/language/templates/tagged/call-expression-argument-list-evaluation.js b/test/language/templates/tagged/call-expression-argument-list-evaluation.js
new file mode 100644
index 000000000..ea2b12496
--- /dev/null
+++ b/test/language/templates/tagged/call-expression-argument-list-evaluation.js
@@ -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: 12.3.7
+description: >
+ 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() {
+ calls++;
+ assert.sameValue(
+ arguments.length, 1, 'NoSubstitutionTemplate arguments length'
+ );
+})`NoSubstitutionTemplate`;
+assert.sameValue(calls, 1, 'NoSubstitutionTemplate function invocation');
+
+calls = 0;
+(function(site, n, s, o, f, r) {
+ calls++;
+ assert.sameValue(arguments.length, 6);
+ 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');
diff --git a/test/language/templates/tagged/chained-application.js b/test/language/templates/tagged/chained-application.js
new file mode 100644
index 000000000..55dea95a1
--- /dev/null
+++ b/test/language/templates/tagged/chained-application.js
@@ -0,0 +1,20 @@
+// 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.3.7
+description: >
+ Tagged templates may be chained and are applied in a left-to-right order.
+---*/
+
+var callCount = 0;
+var expected = ['x', 'y', 'z'];
+var tag = function(templateObject) {
+ assert.sameValue(templateObject[0], expected[callCount]);
+ callCount++;
+ return tag;
+}
+
+var result = tag`x``y``z`;
+
+assert.sameValue(callCount, 3);
+assert.sameValue(result, tag);
diff --git a/test/language/templates/tagged/constructor-invocation.js b/test/language/templates/tagged/constructor-invocation.js
new file mode 100644
index 000000000..1e68e3736
--- /dev/null
+++ b/test/language/templates/tagged/constructor-invocation.js
@@ -0,0 +1,27 @@
+// 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.3.7
+description: >
+ Tagged template application takes precedence over `new` invocation.
+---*/
+
+function Constructor(x) {
+ arg = x;
+}
+var tag = function(x) {
+ templateObject = x;
+ return Constructor;
+};
+var arg = null;
+var instance, templateObject;
+
+instance = new tag`first template`;
+
+assert(instance instanceof Constructor);
+assert.sameValue(templateObject[0], 'first template');
+assert.sameValue(arg, undefined);
+
+instance = new tag`second template`('constructor argument');
+assert.sameValue(templateObject[0], 'second template', 'tagging function');
+assert.sameValue(arg, 'constructor argument');
diff --git a/test/language/templates/tagged/member-expression-context.js b/test/language/templates/tagged/member-expression-context.js
new file mode 100644
index 000000000..818a9e50c
--- /dev/null
+++ b/test/language/templates/tagged/member-expression-context.js
@@ -0,0 +1,20 @@
+// 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.3.7
+description: >
+ 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 context;
+var obj = {
+ fn: function() {
+ context = this;
+ }
+};
+
+obj.fn`NoSubstitutionTemplate`;
+
+assert.sameValue(context, obj);
diff --git a/test/language/templates/tagged/template-object.js b/test/language/templates/tagged/template-object.js
new file mode 100644
index 000000000..bf1bd30a5
--- /dev/null
+++ b/test/language/templates/tagged/template-object.js
@@ -0,0 +1,47 @@
+// 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.3.7
+description: >
+ The first argument to a tagged template should be a template object as
+ defined by the GetTemplateObject abstract operation.
+includes: [propertyHelper.js]
+---*/
+var templateObject;
+
+(function(parameter) {
+ templateObject = parameter;
+})`${1}`;
+
+templateObject.test262Prop = true;
+assert.sameValue(
+ templateObject.test262Prop, undefined, 'The template object is frozen'
+);
+assert(Array.isArray(templateObject.raw), 'The template object is an array');
+
+assert(templateObject.hasOwnProperty('raw'));
+verifyNotEnumerable(templateObject, 'raw');
+verifyNotWritable(templateObject, 'raw')
+verifyNotConfigurable(templateObject, 'raw');
+
+templateObject.raw.test262Prop = true;
+assert.sameValue(
+ templateObject.raw.test262Prop, undefined, 'The "raw" object is frozen'
+);
+assert(Array.isArray(templateObject), 'The "raw" object is an array');
+
+verifyEnumerable(templateObject, '0');
+verifyNotWritable(templateObject, '0')
+verifyNotConfigurable(templateObject, '0');
+
+verifyNotEnumerable(templateObject, 'length');
+verifyNotWritable(templateObject, 'length')
+verifyNotConfigurable(templateObject, 'length');
+
+verifyEnumerable(templateObject.raw, '0');
+verifyNotWritable(templateObject.raw, '0')
+verifyNotConfigurable(templateObject.raw, '0');
+
+verifyNotEnumerable(templateObject.raw, 'length');
+verifyNotWritable(templateObject.raw, 'length')
+verifyNotConfigurable(templateObject.raw, 'length');
diff --git a/test/language/templates/template-values/character-escape-sequence.js b/test/language/templates/template-values/character-escape-sequence.js
new file mode 100644
index 000000000..cf3fecbd9
--- /dev/null
+++ b/test/language/templates/template-values/character-escape-sequence.js
@@ -0,0 +1,88 @@
+// 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);
diff --git a/test/language/templates/template-values/escape-sequence.js b/test/language/templates/template-values/escape-sequence.js
new file mode 100644
index 000000000..e3e0ee827
--- /dev/null
+++ b/test/language/templates/template-values/escape-sequence.js
Binary files differ
diff --git a/test/language/templates/template-values/invalid/hexidecimal-character-escape-sequence-truncated.js b/test/language/templates/template-values/invalid/hexidecimal-character-escape-sequence-truncated.js
new file mode 100644
index 000000000..49403e12d
--- /dev/null
+++ b/test/language/templates/template-values/invalid/hexidecimal-character-escape-sequence-truncated.js
@@ -0,0 +1,11 @@
+// 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.
+negative: SyntaxError
+---*/
+
+(function() {})`\x`;
diff --git a/test/language/templates/template-values/invalid/legacy-octal-escape-sequence.js b/test/language/templates/template-values/invalid/legacy-octal-escape-sequence.js
new file mode 100644
index 000000000..56a7611d8
--- /dev/null
+++ b/test/language/templates/template-values/invalid/legacy-octal-escape-sequence.js
@@ -0,0 +1,11 @@
+// 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: 16.1
+description: >
+ TemplateCharacter (11.8.6) must not be extended to include
+ LegacyOctalEscapeSequence as defined in B.1.2.
+negative: SyntaxError
+---*/
+
+(function() {})`\00`;
diff --git a/test/language/templates/template-values/invalid/unicode-escape-sequence-truncated.js b/test/language/templates/template-values/invalid/unicode-escape-sequence-truncated.js
new file mode 100644
index 000000000..4a228da53
--- /dev/null
+++ b/test/language/templates/template-values/invalid/unicode-escape-sequence-truncated.js
@@ -0,0 +1,11 @@
+// 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.
+negative: SyntaxError
+---*/
+
+(function() {})`\u`;
diff --git a/test/language/templates/template-values/line-continuation.js b/test/language/templates/template-values/line-continuation.js
new file mode 100644
index 000000000..8488a99c4
--- /dev/null
+++ b/test/language/templates/template-values/line-continuation.js
@@ -0,0 +1,19 @@
+// 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 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.raw[0], '\u005C\n\u005C\n\u005C\n');
+})`\
+\
+\ `
+assert.sameValue(calls, 1);
diff --git a/test/language/templates/template-values/line-terminator-sequence.js b/test/language/templates/template-values/line-terminator-sequence.js
new file mode 100644
index 000000000..507b5816a
--- /dev/null
+++ b/test/language/templates/template-values/line-terminator-sequence.js
@@ -0,0 +1,20 @@
+// 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 LineTerminatorSequence :: <LF> is the code unit value 0x000A.
+ The TRV of LineTerminatorSequence :: <CR> is the code unit value 0x000A.
+ 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.raw[0], '\n\n\n');
+})`
+
+ `;
+assert.sameValue(calls, 1);
diff --git a/test/language/templates/template-values/multi-line.js b/test/language/templates/template-values/multi-line.js
new file mode 100644
index 000000000..cafb05179
--- /dev/null
+++ b/test/language/templates/template-values/multi-line.js
@@ -0,0 +1,13 @@
+// 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');
diff --git a/test/language/templates/template-values/no-substitution.js b/test/language/templates/template-values/no-substitution.js
new file mode 100644
index 000000000..681218583
--- /dev/null
+++ b/test/language/templates/template-values/no-substitution.js
@@ -0,0 +1,27 @@
+// 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 and TRV of NoSubstitutionTemplate :: `` is the empty code unit
+ sequence.
+ The TV of NoSubstitutionTemplate :: ` TemplateCharacters ` is the TV of
+ TemplateCharacters.
+---*/
+
+var calls;
+
+calls = 0;
+(function(s) {
+ calls++;
+ assert.sameValue(s[0], '', 'Template value (empty)');
+ assert.sameValue(s.raw[0], '', 'Template raw value (empty)');
+})``;
+assert.sameValue(calls, 1);
+
+calls = 0;
+(function(s) {
+ calls++;
+ assert.sameValue(s[0], 'foo', 'Template value (with content)');
+})`foo`;
+assert.sameValue(calls, 1);
diff --git a/test/language/templates/template-values/non-escape-character.js b/test/language/templates/template-values/non-escape-character.js
new file mode 100644
index 000000000..031c79732
--- /dev/null
+++ b/test/language/templates/template-values/non-escape-character.js
Binary files differ
diff --git a/test/language/templates/template-values/null-character-escape-sequence.js b/test/language/templates/template-values/null-character-escape-sequence.js
new file mode 100644
index 000000000..c7eadf036
--- /dev/null
+++ b/test/language/templates/template-values/null-character-escape-sequence.js
Binary files differ
diff --git a/test/language/templates/template-values/template-character.js b/test/language/templates/template-values/template-character.js
new file mode 100644
index 000000000..7b2e0aae6
--- /dev/null
+++ b/test/language/templates/template-values/template-character.js
@@ -0,0 +1,29 @@
+// 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);
diff --git a/test/language/templates/template-values/template-characters.js b/test/language/templates/template-values/template-characters.js
new file mode 100644
index 000000000..8d1b7fb35
--- /dev/null
+++ b/test/language/templates/template-values/template-characters.js
@@ -0,0 +1,24 @@
+// 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');
diff --git a/test/language/templates/template-values/template-head.js b/test/language/templates/template-values/template-head.js
new file mode 100644
index 000000000..b73dd3b56
--- /dev/null
+++ b/test/language/templates/template-values/template-head.js
@@ -0,0 +1,29 @@
+// 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 and TRV of TemplateHead :: `${ is the empty code unit sequence.
+ The TV of TemplateHead :: ` TemplateCharacters ${ is the TV of
+ TemplateCharacters.
+ The TRV of TemplateHead :: ` TemplateCharacters ${ is the TRV of
+ TemplateCharacters.
+---*/
+
+var calls;
+
+calls = 0;
+(function(s) {
+ calls++;
+ assert.sameValue(s[0], '', 'Template value (empty)');
+ assert.sameValue(s.raw[0], '', 'Template raw value (empty)');
+})`${1}`;
+assert.sameValue(calls, 1);
+
+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${1}`;
+assert.sameValue(calls, 1);
diff --git a/test/language/templates/template-values/template-middle.js b/test/language/templates/template-values/template-middle.js
new file mode 100644
index 000000000..db100e923
--- /dev/null
+++ b/test/language/templates/template-values/template-middle.js
@@ -0,0 +1,29 @@
+// 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 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.
+---*/
+
+var calls;
+
+calls = 0;
+(function(s) {
+ calls++;
+ assert.sameValue(s[1], '', 'Template value (empty)');
+ assert.sameValue(s.raw[1], '', 'Template raw value (empty)');
+})`${1}${2}`;
+assert.sameValue(calls, 1);
+
+calls = 0;
+(function(s) {
+ calls++;
+ assert.sameValue(s[1], 'foo', 'Template value (with content)');
+ assert.sameValue(s.raw[1], 'foo', 'Template raw value (with content)');
+})`${1}foo${2}`;
+assert.sameValue(calls, 1);
diff --git a/test/language/templates/template-values/template-tail.js b/test/language/templates/template-values/template-tail.js
new file mode 100644
index 000000000..541883eed
--- /dev/null
+++ b/test/language/templates/template-values/template-tail.js
@@ -0,0 +1,29 @@
+// 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 and TRV of TemplateTail :: }` is the empty code unit sequence.
+ The TV of TemplateTail :: } TemplateCharacters ` is the TV of
+ TemplateCharacters.
+ The TRV of TemplateTail :: } TemplateCharacters ` is the TRV of
+ TemplateCharacters.
+---*/
+
+var calls;
+
+calls = 0;
+(function(s) {
+ calls++;
+ assert.sameValue(s[1], '', 'Template value (empty)');
+ assert.sameValue(s.raw[1], '', 'Template raw value (empty)');
+})`${1}`;
+assert.sameValue(calls, 1);
+
+calls = 0;
+(function(s) {
+ calls++;
+ assert.sameValue(s[1], 'foo', 'Template value (with content)');
+ assert.sameValue(s.raw[1], 'foo', 'Template raw value (with content)');
+})`${1}foo`;
+assert.sameValue(calls, 1);
diff --git a/test/language/templates/template-values/utf16-escape-sequence.js b/test/language/templates/template-values/utf16-escape-sequence.js
new file mode 100644
index 000000000..14fa3b500
--- /dev/null
+++ b/test/language/templates/template-values/utf16-escape-sequence.js
@@ -0,0 +1,29 @@
+// 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 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
+ 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], '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(calls, 1);
diff --git a/test/language/templates/template-values/zwnbsp.js b/test/language/templates/template-values/zwnbsp.js
new file mode 100644
index 000000000..f4d095dc9
--- /dev/null
+++ b/test/language/templates/template-values/zwnbsp.js
@@ -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: 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'
+);