diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-06-10 01:08:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-10 01:08:58 +0800 |
commit | 4ad7b1dae46fb5bf98f12859b2906381421563d4 (patch) | |
tree | d3ea1801fedbcc30a34da5bde79fa6a2bd9534c2 /test | |
parent | 9186859cb7df0b1f7ac328e19979b14967dbadf2 (diff) | |
download | tracifyjs-4ad7b1dae46fb5bf98f12859b2906381421563d4.tar.gz tracifyjs-4ad7b1dae46fb5bf98f12859b2906381421563d4.zip |
fix portability of `sandbox.run_code()` on Node.js 0.1x (#2078)
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/sandbox.js | 14 | ||||
-rw-r--r-- | test/sandbox.js | 5 |
2 files changed, 18 insertions, 1 deletions
diff --git a/test/compress/sandbox.js b/test/compress/sandbox.js new file mode 100644 index 00000000..6c2be933 --- /dev/null +++ b/test/compress/sandbox.js @@ -0,0 +1,14 @@ +console_log: { + input: { + console.log("%% %s"); + console.log("%% %s", "%s"); + } + expect: { + console.log("%% %s"); + console.log("%% %s", "%s"); + } + expect_stdout: [ + "%% %s", + "% %s", + ] +} diff --git a/test/sandbox.js b/test/sandbox.js index ca1781c6..cb1e18c9 100644 --- a/test/sandbox.js +++ b/test/sandbox.js @@ -52,7 +52,10 @@ exports.run_code = function(code) { "}();", ].join("\n"), { console: { - log: function() { + log: function(msg) { + if (arguments.length == 1 && typeof msg == "string") { + return console.log("%s", msg); + } return console.log.apply(console, [].map.call(arguments, function(arg) { return safe_log(arg, 3); })); |