diff --git a/test/parser/expressions/template.ts b/test/parser/expressions/template.ts index a6311be8..fa7a9a96 100644 --- a/test/parser/expressions/template.ts +++ b/test/parser/expressions/template.ts @@ -338,7 +338,14 @@ describe('Expressions - Template', () => { 'test`\\18`;', '(`\n`)', '(`\r`)', - 'new nestedNewOperatorFunction`1``2``3``array`' + 'new nestedNewOperatorFunction`1``2``3``array`', + "tag()`'\\00a0'`;", + "(tag = () => {})`'\\00a0'`", + "(() => {})`'\\00a0'`", + "(function tag() { return () => {}; })()`'\\00a0'`", + "(function() { return () => {}; })()`'\\00a0'`", + "(function tag() {})`'\\00a0'`", + "(function() {})`'\\00a0'`" ]) { it(`${arg}`, () => { t.doesNotThrow(() => { @@ -4033,6 +4040,92 @@ describe('Expressions - Template', () => { } } } + ], + [ + "tag()`'\\00a0'`;", + Context.None, + { + body: [ + { + expression: { + quasi: { + expressions: [], + quasis: [ + { + tail: true, + type: 'TemplateElement', + value: { + cooked: undefined, + raw: "'\\00a0'" + } + } + ], + type: 'TemplateLiteral' + }, + tag: { + arguments: [], + callee: { + name: 'tag', + type: 'Identifier' + }, + type: 'CallExpression' + }, + type: 'TaggedTemplateExpression' + }, + type: 'ExpressionStatement' + } + ], + sourceType: 'script', + type: 'Program' + } + ], + [ + "(tag = () => {})`'\\00a0'`", + Context.None, + { + body: [ + { + expression: { + quasi: { + expressions: [], + quasis: [ + { + tail: true, + type: 'TemplateElement', + value: { + cooked: undefined, + raw: "'\\00a0'" + } + } + ], + type: 'TemplateLiteral' + }, + tag: { + left: { + name: 'tag', + type: 'Identifier' + }, + operator: '=', + right: { + async: false, + body: { + body: [], + type: 'BlockStatement' + }, + expression: false, + params: [], + type: 'ArrowFunctionExpression' + }, + type: 'AssignmentExpression' + }, + type: 'TaggedTemplateExpression' + }, + type: 'ExpressionStatement' + } + ], + sourceType: 'script', + type: 'Program' + } ] ]); });