Created
June 12, 2016 12:50
-
-
Save avdg/edfdb9543d06bee67842a29fcaa53b99 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
From 733e6c30ff73eeb78ddb82630ea1534a207bbd9f Mon Sep 17 00:00:00 2001 | |
From: Anthony Van de Gejuchte <[email protected]> | |
Date: Sun, 12 Jun 2016 14:48:30 +0200 | |
Subject: [PATCH 2/2] Fix tests | |
--- | |
lib/output.js | 8 -------- | |
test/mocha/new.js | 10 +++++----- | |
2 files changed, 5 insertions(+), 13 deletions(-) | |
diff --git a/lib/output.js b/lib/output.js | |
index c917786..4639a01 100644 | |
--- a/lib/output.js | |
+++ b/lib/output.js | |
@@ -1286,14 +1286,6 @@ function OutputStream(options) { | |
function need_constructor_parens(self, output) { | |
// Always print parentheses with arguments | |
if (self.args.length > 0) return true; | |
- | |
- // Certain expressions are safe to add constructor calling parentheses | |
- return output.option("beautify") && ( | |
- self.expression instanceof AST_SymbolRef || | |
- self.expression instanceof AST_Call || | |
- self.expression instanceof AST_Function || | |
- self.expression instanceof AST_Assign | |
- ); | |
}; | |
function best_of(a) { | |
diff --git a/test/mocha/new.js b/test/mocha/new.js | |
index 6c4f13b..8c0f24b 100644 | |
--- a/test/mocha/new.js | |
+++ b/test/mocha/new.js | |
@@ -19,17 +19,17 @@ describe("New", function() { | |
]; | |
var expected = [ | |
"new x(1);", | |
- "new x();", | |
- "new new x()();", | |
+ "new x;", | |
+ "new (new x);", | |
"new function(foo) {\n this.foo = foo;\n}(1);", | |
- "new function(foo) {\n this.foo = foo;\n}();", | |
+ "new function(foo) {\n this.foo = foo;\n};", | |
"new function test(foo) {\n this.foo = foo;\n}(1);", | |
- "new function test(foo) {\n this.foo = foo;\n}();", | |
+ "new function test(foo) {\n this.foo = foo;\n};", | |
"new true;", | |
"new 0;", | |
"new (!0);", | |
"new (bar = function(foo) {\n this.foo = foo;\n})(123);", | |
- "new (bar = function(foo) {\n this.foo = foo;\n})();" | |
+ "new (bar = function(foo) {\n this.foo = foo;\n});" | |
]; | |
for (var i = 0; i < tests.length; i++) { | |
assert.strictEqual( | |
-- | |
2.8.2.windows.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment