-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 馃槩
- Loading branch information
Diogo Franco
committed
Aug 12, 2017
1 parent
cd66657
commit 0538c3c
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
packages/babel-plugin-transform-es2015-template-literals/test/fixtures/spec/order2/exec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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]); |
3 changes: 3 additions & 0 deletions
3
...es/babel-plugin-transform-es2015-template-literals/test/fixtures/spec/order2/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"minNodeVersion": "6.0.0" | ||
} |