Skip to content

Commit

Permalink
Add octal string template tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ypapouski committed Apr 3, 2024
1 parent 5bd213a commit 94c3066
Showing 1 changed file with 94 additions and 1 deletion.
95 changes: 94 additions & 1 deletion test/parser/expressions/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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'
}
]
]);
});

0 comments on commit 94c3066

Please sign in to comment.