Debian Codegraph @

js/src/tests/test262/language/expressions/template-literal/tv-template-head.js

raw
1 // Copyright (C) 2014 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 es6id: 11.8.6.1
5 description: Template values of the template head pattern
6 info: |
7 The TV and TRV of TemplateHead :: `${ is the empty code unit sequence.
8 The TV of TemplateHead :: ` TemplateCharacters ${ is the TV of
9 TemplateCharacters.
10 The TRV of TemplateHead :: ` TemplateCharacters ${ is the TRV of
11 TemplateCharacters.
12 ---*/
13
14 var calls;
15
16 calls = 0;
17 (function(s) {
18 calls++;
19 assert.sameValue(s[0], '', 'Template value (empty)');
20 assert.sameValue(s.raw[0], '', 'Template raw value (empty)');
21 })`${1}`;
22 assert.sameValue(calls, 1);
23
24 calls = 0;
25 (function(s) {
26 calls++;
27 assert.sameValue(s[0], 'foo', 'Template value (with content)');
28 assert.sameValue(s.raw[0], 'foo', 'Template raw value (with content)');
29 })`foo${1}`;
30 assert.sameValue(calls, 1);
31
32 reportCompare(0, 0);