tv-template-middle.js (863B)
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 middle pattern 6 info: | 7 The TV and TRV of TemplateMiddle :: }${ is the empty code unit sequence. 8 The TRV of TemplateMiddle :: } TemplateCharacters ${ is the TRV of 9 TemplateCharacters. 10 ---*/ 11 12 var calls; 13 14 calls = 0; 15 (function(s) { 16 calls++; 17 assert.sameValue(s[1], '', 'Template value (empty)'); 18 assert.sameValue(s.raw[1], '', 'Template raw value (empty)'); 19 })`${1}${2}`; 20 assert.sameValue(calls, 1); 21 22 calls = 0; 23 (function(s) { 24 calls++; 25 assert.sameValue(s[1], 'foo', 'Template value (with content)'); 26 assert.sameValue(s.raw[1], 'foo', 'Template raw value (with content)'); 27 })`${1}foo${2}`; 28 assert.sameValue(calls, 1); 29 30 reportCompare(0, 0);