Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Jan 2, 2023
1 parent a143a20 commit 37b300f
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions packages/babel-traverse/test/evaluation.js
Expand Up @@ -100,12 +100,27 @@ describe("evaluation", function () {
).toBe(false);
});

it("should evaluate template literals", function () {
expect(
getPath("var x = 8; var y = 1; var z = `value is ${x >>> y}`")
.get("body.2.declarations.0.init")
.evaluate().value,
).toBe("value is 4");
describe("template literals", function () {
it("should evaluate template literals", function () {
expect(
getPath("var x = 8; var y = 1; var z = `value is ${x >>> y}`")
.get("body.2.declarations.0.init")
.evaluate().value,
).toBe("value is 4");
});

it("shold evaluate String.raw tags", function () {
expect(
getPath("String.raw`a\\n${1}\\u`;").get("body.0.expression").evaluate()
.value,
).toBe("a\\n1\\u");
});

addDeoptTest(
"a`x${b}y`",
"TaggedTemplateExpression",
"TaggedTemplateExpression",
);
});

it("should evaluate member expressions", function () {
Expand Down

0 comments on commit 37b300f

Please sign in to comment.