var node = exprs[i];
var ev = node.evaluate(compressor);
if (ev === node) continue;
- ev = "" + ev;
+ ev = ("" + ev).replace(/\r|\\|`/g, function(s) {
+ return "\\" + (s == "\r" ? "r" : s);
+ });
if (ev.length > node.print_to_string().length + 3) continue;
exprs.splice(i, 1);
strs.splice(i, 2, strs[i] + ev + strs[i + 1]);
expect_stdout: "PASS"
node_version: ">=4"
}
+
+issue_4606: {
+ options = {
+ evaluate: true,
+ templates: true,
+ }
+ input: {
+ console.log(`${typeof A} ${"\r"} ${"\\"} ${"`"}`);
+ }
+ expect: {
+ console.log(`${typeof A} \r \\ \``);
+ }
+ expect_stdout: "undefined \r \\ `"
+ node_version: ">=4"
+}