aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/compress/comparing.js28
-rw-r--r--test/sandbox.js2
2 files changed, 29 insertions, 1 deletions
diff --git a/test/compress/comparing.js b/test/compress/comparing.js
index 17b3ac47..1ff29565 100644
--- a/test/compress/comparing.js
+++ b/test/compress/comparing.js
@@ -295,3 +295,31 @@ issue_2857_6: {
}
expect_stdout: "true"
}
+
+is_boolean_unsafe: {
+ options = {
+ comparisons: true,
+ unsafe: true,
+ }
+ input: {
+ console.log(/foo/.test("bar") === [].isPrototypeOf({}));
+ }
+ expect: {
+ console.log(/foo/.test("bar") == [].isPrototypeOf({}));
+ }
+ expect_stdout: "true"
+}
+
+is_number_unsafe: {
+ options = {
+ comparisons: true,
+ unsafe: true,
+ }
+ input: {
+ console.log(Math.acos(42) !== "foo".charCodeAt(4));
+ }
+ expect: {
+ console.log(Math.acos(42) != "foo".charCodeAt(4));
+ }
+ expect_stdout: "true"
+}
diff --git a/test/sandbox.js b/test/sandbox.js
index ecf95d31..e85ebd79 100644
--- a/test/sandbox.js
+++ b/test/sandbox.js
@@ -79,7 +79,7 @@ exports.run_code = function(code, reuse) {
return ex;
} finally {
process.stdout.write = original_write;
- if (!reuse || /prototype/.test(code)) {
+ if (!reuse || code.indexOf(".prototype") >= 0) {
context = null;
} else for (var key in context) {
delete context[key];