Add another test for runtime order of template literals (#6092)

More proof that it really is unsafe to merge the .concat calls if the
value is an expression that has any chance of executing impure code 😢
This commit is contained in:
Diogo Franco 2017-08-12 14:11:27 +09:00 committed by GitHub
parent cd66657f34
commit 0538c3cd8c
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,19 @@
const calls = [];
`
${{
[Symbol.toPrimitive]() {
calls.push(1);
return "foo";
}
}}
${1 +
{
valueOf() {
calls.push(2);
return 2;
}
}}
`;
assert.deepEqual(calls, [1, 2]);

View File

@ -0,0 +1,3 @@
{
"minNodeVersion": "6.0.0"
}