From df70be4ebbb6c07af0f629e49d31a70f9b727ac3 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 7 Nov 2014 12:33:35 +1100 Subject: [PATCH] clean up and fix tests --- .../computed-property-comments-2/actual.js | 4 +- .../computed-property-comments-2/expected.js | 18 ++++---- .../computed-property-comments/actual.js | 4 +- .../computed-property-comments/expected.js | 24 ++++++---- .../do-while-line-comment/expected.js | 3 +- .../comments/empty-line-comment/actual.js | 3 +- .../comments/empty-line-comment/expected.js | 2 +- .../function-block-line-comment/expected.js | 14 ++---- .../if-block-line-comment/expected.js | 2 +- .../if-empty-line-comment/expected.js | 2 +- .../comments/return-no-argument/expected.js | 4 +- .../simple-a-lot-of-line-comment/expected.js | 46 ++++++++++--------- .../simple-a-lot-of-multi-comment/actual.js | 4 +- .../simple-a-lot-of-multi-comment/expected.js | 44 +++++++++--------- .../comments/simple-line-comment/expected.js | 3 +- .../comments/simple-multi-comment/expected.js | 20 ++++---- .../simple-statement-comment/expected.js | 2 +- .../try-block-line-comment/expected.js | 22 ++++----- .../expected.js | 12 ++--- .../expected.js | 20 ++++---- .../actual.js | 12 ++--- .../expected.js | 22 ++++----- .../edgecase/for-in-no-in/expected.js | 4 +- .../edgecase/new-precedence/expected.js | 6 +-- .../expected.js | 4 +- .../unnecessary-parenthesized-in-2/actual.js | 2 - .../expected.js | 2 - .../unnecessary-parenthesized-in/actual.js | 1 - .../unnecessary-parenthesized-in/expected.js | 1 - .../class-declaration/expected.js | 12 +++++ .../class-expression/actual.js | 22 ++++----- .../class-expression/expected.js | 12 +++++ .../computed-property/expected.js | 8 +++- .../default-parameter/expected.js | 3 ++ .../destructuring-assignment/actual.js | 10 ++-- .../destructuring-assignment/expected.js | 16 ++----- .../for-of-statement/expected.js | 1 + .../one-assignment-property/expected.js | 6 +-- .../templates-escape/expected.js | 1 + .../harmony-edgecase/templates/expected.js | 10 +++- .../array-comprehension/arguments/expected.js | 3 +- .../multiple-if/expected.js | 5 +- .../array-comprehension/multiple/expected.js | 1 - .../array-comprehension/this/expected.js | 3 +- .../arrow-functions/arguments/actual.js | 8 ++-- .../arrow-functions/arguments/expected.js | 7 ++- .../default-parameters/expected.js | 3 +- .../arrow-functions/nested/expected.js | 25 +++++----- .../classes/accessing-super-class/expected.js | 46 +++++++++++-------- .../accessing-super-properties/expected.js | 16 ++++--- .../calling-super-properties/expected.js | 27 ++++++----- .../classes/constructor/expected.js | 16 ++++--- .../instance-getter-and-setter/expected.js | 19 ++++---- .../classes/instance-getter/expected.js | 13 ++++-- .../classes/instance-method/expected.js | 15 +++--- .../classes/instance-setter/expected.js | 13 ++++-- .../classes/statement/expected.js | 13 ++++-- .../transformation/classes/static/expected.js | 1 + .../expected.js | 14 +++--- .../expected.js | 16 ++++--- .../classes/super-class/expected.js | 16 ++++--- .../comments/preserve-multi-line/actual.js | 5 -- .../comments/preserve-multi-line/expected.js | 9 ---- .../comments/preserve-single-line/actual.js | 3 -- .../comments/preserve-single-line/expected.js | 5 -- .../constants/destructuring/expected.js | 10 +--- .../default-parameters/multiple/expected.js | 5 +- .../default-parameters/single/expected.js | 3 +- .../destructuring/for-in/expected.js | 3 +- .../destructuring/parameters/expected.js | 9 ++-- .../transformation/jsx/everything/expected.js | 6 ++- .../jsx/self-closing-tags/expected.js | 4 +- .../jsx/tags-with-children/expected.js | 8 +++- .../modules-amd/exports-variable/expected.js | 15 ++---- .../hoist-function-exports/actual.js | 2 +- .../hoist-function-exports/expected.js | 5 +- .../modules-amd/overview/expected.js | 5 +- .../exports-variable/expected.js | 15 ++---- .../hoist-function-exports/actual.js | 2 +- .../hoist-function-exports/expected.js | 3 +- .../modules-common/overview/expected.js | 5 +- .../modules-umd/exports-variable/expected.js | 15 ++---- .../hoist-function-exports/actual.js | 2 +- .../hoist-function-exports/expected.js | 5 +- .../modules-umd/overview/expected.js | 5 +- .../getter-and-setter/expected.js | 18 ++++---- .../getter/expected.js | 12 +++-- .../method/expected.js | 8 ++-- .../setter/expected.js | 12 +++-- .../property-name-shorthand/mixed/expected.js | 6 +-- .../multiple/expected.js | 5 +- .../expected.js | 14 +++--- .../source-maps/class/expected.js | 15 ++++-- .../source-maps/class/source-mappings.json | 6 +-- test/generation.js | 8 ++-- test/mocha.opts | 1 - 96 files changed, 496 insertions(+), 446 deletions(-) delete mode 100644 test/fixtures/generation/edgecase/unnecessary-parenthesized-in-2/actual.js delete mode 100644 test/fixtures/generation/edgecase/unnecessary-parenthesized-in-2/expected.js delete mode 100644 test/fixtures/generation/edgecase/unnecessary-parenthesized-in/actual.js delete mode 100644 test/fixtures/generation/edgecase/unnecessary-parenthesized-in/expected.js delete mode 100644 test/fixtures/transformation/comments/preserve-multi-line/actual.js delete mode 100644 test/fixtures/transformation/comments/preserve-multi-line/expected.js delete mode 100644 test/fixtures/transformation/comments/preserve-single-line/actual.js delete mode 100644 test/fixtures/transformation/comments/preserve-single-line/expected.js diff --git a/test/fixtures/generation/comments/computed-property-comments-2/actual.js b/test/fixtures/generation/comments/computed-property-comments-2/actual.js index ae6b5f7644..0c0c0272a5 100644 --- a/test/fixtures/generation/comments/computed-property-comments-2/actual.js +++ b/test/fixtures/generation/comments/computed-property-comments-2/actual.js @@ -4,7 +4,7 @@ var test = { */ ["a"]:"1", [/* - * Inside bracket init - */ + * Inside bracket init + */ "b"]:"2" }, ok = 42; diff --git a/test/fixtures/generation/comments/computed-property-comments-2/expected.js b/test/fixtures/generation/comments/computed-property-comments-2/expected.js index 4eb102c915..285ad050f3 100644 --- a/test/fixtures/generation/comments/computed-property-comments-2/expected.js +++ b/test/fixtures/generation/comments/computed-property-comments-2/expected.js @@ -1,10 +1,10 @@ var test = { - /** - * Before bracket init - */ - ["a"]: "1", - [/* - * Inside bracket init - */ - "b"]: "2" - }, ok = 42; + /** + * Before bracket init + */ + ["a"]: "1", + [/* + * Inside bracket init + */ + "b"]: "2" +}, ok = 42; diff --git a/test/fixtures/generation/comments/computed-property-comments/actual.js b/test/fixtures/generation/comments/computed-property-comments/actual.js index 05c543c4c2..0c7aae7d18 100644 --- a/test/fixtures/generation/comments/computed-property-comments/actual.js +++ b/test/fixtures/generation/comments/computed-property-comments/actual.js @@ -5,8 +5,8 @@ var test = { ["a"]:"1", [/* - * Inside bracket init - */ + * Inside bracket init + */ "b"]:"2", ["c" diff --git a/test/fixtures/generation/comments/computed-property-comments/expected.js b/test/fixtures/generation/comments/computed-property-comments/expected.js index 297595ec42..c6ffd441f8 100644 --- a/test/fixtures/generation/comments/computed-property-comments/expected.js +++ b/test/fixtures/generation/comments/computed-property-comments/expected.js @@ -3,17 +3,25 @@ var test = { * Before bracket init */ ["a"]: "1", + [/* - * Inside bracket init - */ + * Inside bracket init + */ "b"]: "2", - ["c" /* - * After bracket key - */]: "3", + + ["c" + /* + * After bracket key + */]: "3", + // Before bracket, line comment ["d"]: "4", - [// Inside bracket, line comment + + [ + // Inside bracket, line comment "e"]: "5", - ["f" // After bracket, line comment -]: "6" + + ["f" + // After bracket, line comment + ]: "6" }; diff --git a/test/fixtures/generation/comments/do-while-line-comment/expected.js b/test/fixtures/generation/comments/do-while-line-comment/expected.js index 760ae4934e..dbcec4152a 100644 --- a/test/fixtures/generation/comments/do-while-line-comment/expected.js +++ b/test/fixtures/generation/comments/do-while-line-comment/expected.js @@ -1,3 +1,2 @@ -do { -} // LINE +do {} // LINE while (true); diff --git a/test/fixtures/generation/comments/empty-line-comment/actual.js b/test/fixtures/generation/comments/empty-line-comment/actual.js index 7070de7861..ea9f2a7244 100644 --- a/test/fixtures/generation/comments/empty-line-comment/actual.js +++ b/test/fixtures/generation/comments/empty-line-comment/actual.js @@ -1,5 +1,4 @@ function test() { // Leading to EmptyStatement -; - // Trailing to EmptyStatement +; // Trailing to EmptyStatement } diff --git a/test/fixtures/generation/comments/empty-line-comment/expected.js b/test/fixtures/generation/comments/empty-line-comment/expected.js index 40cf20fe40..118cbc17a2 100644 --- a/test/fixtures/generation/comments/empty-line-comment/expected.js +++ b/test/fixtures/generation/comments/empty-line-comment/expected.js @@ -1,4 +1,4 @@ function test() { // Leading to EmptyStatement - ; // Trailing to EmptyStatement + ; // Trailing to EmptyStatement } diff --git a/test/fixtures/generation/comments/function-block-line-comment/expected.js b/test/fixtures/generation/comments/function-block-line-comment/expected.js index 5a2df30b10..f37f446d86 100644 --- a/test/fixtures/generation/comments/function-block-line-comment/expected.js +++ b/test/fixtures/generation/comments/function-block-line-comment/expected.js @@ -1,12 +1,6 @@ -!function () { -} // +!function () {} // , 42; -!{ - get 42() { - } // -, - foo: 42 -}; -(function () { -} // +!{ get 42() {} // + , foo: 42 }; +(function () {} // ); diff --git a/test/fixtures/generation/comments/if-block-line-comment/expected.js b/test/fixtures/generation/comments/if-block-line-comment/expected.js index 478bb4f948..cc93b54438 100644 --- a/test/fixtures/generation/comments/if-block-line-comment/expected.js +++ b/test/fixtures/generation/comments/if-block-line-comment/expected.js @@ -2,4 +2,4 @@ if (cond) // Leading to if-block { print("hello"); - } // Trailing to if-block + } // Trailing to if-block diff --git a/test/fixtures/generation/comments/if-empty-line-comment/expected.js b/test/fixtures/generation/comments/if-empty-line-comment/expected.js index aa42a3d108..bcb989f64f 100644 --- a/test/fixtures/generation/comments/if-empty-line-comment/expected.js +++ b/test/fixtures/generation/comments/if-empty-line-comment/expected.js @@ -1,3 +1,3 @@ if (cond) // Leading to EmptyStatement - ; // Trailing to EmptyStatement + ; // Trailing to EmptyStatement diff --git a/test/fixtures/generation/comments/return-no-argument/expected.js b/test/fixtures/generation/comments/return-no-argument/expected.js index 062140701b..0dc96b3a8c 100644 --- a/test/fixtures/generation/comments/return-no-argument/expected.js +++ b/test/fixtures/generation/comments/return-no-argument/expected.js @@ -1,3 +1,3 @@ (function () { - return; // comment -}()); + return; // comment +})(); diff --git a/test/fixtures/generation/comments/simple-a-lot-of-line-comment/expected.js b/test/fixtures/generation/comments/simple-a-lot-of-line-comment/expected.js index e75d7bc190..47869b2606 100644 --- a/test/fixtures/generation/comments/simple-a-lot-of-line-comment/expected.js +++ b/test/fixtures/generation/comments/simple-a-lot-of-line-comment/expected.js @@ -19,25 +19,27 @@ // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -function test() { -} // Copyright (C) 2012 Yusuke Suzuki - // - // Redistribution and use in source and binary forms, with or without - // modification, are permitted provided that the following conditions are met: - // - // * Redistributions of source code must retain the above copyright - // notice, this list of conditions and the following disclaimer. - // * Redistributions in binary form must reproduce the above copyright - // notice, this list of conditions and the following disclaimer in the - // documentation and/or other materials provided with the distribution. - // - // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - // ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +function test() {} + +// Copyright (C) 2012 Yusuke Suzuki +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/test/fixtures/generation/comments/simple-a-lot-of-multi-comment/actual.js b/test/fixtures/generation/comments/simple-a-lot-of-multi-comment/actual.js index 7dab84fae5..1076529e0b 100644 --- a/test/fixtures/generation/comments/simple-a-lot-of-multi-comment/actual.js +++ b/test/fixtures/generation/comments/simple-a-lot-of-multi-comment/actual.js @@ -22,7 +22,9 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -function test() { } +function test() { + +} /* Copyright (C) 2012 Yusuke Suzuki diff --git a/test/fixtures/generation/comments/simple-a-lot-of-multi-comment/expected.js b/test/fixtures/generation/comments/simple-a-lot-of-multi-comment/expected.js index a12242f98c..de284d6c01 100644 --- a/test/fixtures/generation/comments/simple-a-lot-of-multi-comment/expected.js +++ b/test/fixtures/generation/comments/simple-a-lot-of-multi-comment/expected.js @@ -21,27 +21,29 @@ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -function test() { -} /* - Copyright (C) 2012 Yusuke Suzuki - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: +function test() {} - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. +/* + Copyright (C) 2012 Yusuke Suzuki - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ diff --git a/test/fixtures/generation/comments/simple-line-comment/expected.js b/test/fixtures/generation/comments/simple-line-comment/expected.js index c76bf36689..780a9c2b4a 100644 --- a/test/fixtures/generation/comments/simple-line-comment/expected.js +++ b/test/fixtures/generation/comments/simple-line-comment/expected.js @@ -1,2 +1,3 @@ // Leading -var i = 20; // Trailing +var i = 20; +// Trailing diff --git a/test/fixtures/generation/comments/simple-multi-comment/expected.js b/test/fixtures/generation/comments/simple-multi-comment/expected.js index 21a1683286..e0ad4c2075 100644 --- a/test/fixtures/generation/comments/simple-multi-comment/expected.js +++ b/test/fixtures/generation/comments/simple-multi-comment/expected.js @@ -2,17 +2,21 @@ function test() { /* * Leading comment */ + /* * * Leading comment 2 * */ - var i = 20; /* - * Trailing comment - */ - /* - * - * Trailing comment 2 - * - */ + + var i = 20; + /* + * Trailing comment + */ + + /* + * + * Trailing comment 2 + * + */ } diff --git a/test/fixtures/generation/comments/simple-statement-comment/expected.js b/test/fixtures/generation/comments/simple-statement-comment/expected.js index 322d46769b..733f7f0c6b 100644 --- a/test/fixtures/generation/comments/simple-statement-comment/expected.js +++ b/test/fixtures/generation/comments/simple-statement-comment/expected.js @@ -1 +1 @@ -; // Trailing +; // Trailing diff --git a/test/fixtures/generation/comments/try-block-line-comment/expected.js b/test/fixtures/generation/comments/try-block-line-comment/expected.js index 8a5a8676aa..034d32569f 100644 --- a/test/fixtures/generation/comments/try-block-line-comment/expected.js +++ b/test/fixtures/generation/comments/try-block-line-comment/expected.js @@ -1,16 +1,10 @@ -try { -} // -finally { -} -try { -} catch (e) { -} // -finally { -} +try {} // +finally {} + +try {} catch (e) {} // +finally {} + { - try { - } catch (e) { - } // - finally { - } + try {} catch (e) {} // + finally {} } diff --git a/test/fixtures/generation/comments/variable-declarator-line-comment/expected.js b/test/fixtures/generation/comments/variable-declarator-line-comment/expected.js index 5cc784bea2..39d4b0648a 100644 --- a/test/fixtures/generation/comments/variable-declarator-line-comment/expected.js +++ b/test/fixtures/generation/comments/variable-declarator-line-comment/expected.js @@ -1,9 +1,9 @@ function test() { var - // Leading to VariableDeclarator - // Leading to VariableDeclarator - i = 20, - // Leading to VariableDeclarator - // Leading to VariableDeclarator - j = 20; + // Leading to VariableDeclarator + // Leading to VariableDeclarator + i = 20, + // Leading to VariableDeclarator + // Leading to VariableDeclarator + j = 20; } diff --git a/test/fixtures/generation/comments/variable-declarator-multi-comment/expected.js b/test/fixtures/generation/comments/variable-declarator-multi-comment/expected.js index 0dbf94b237..5ef974297b 100644 --- a/test/fixtures/generation/comments/variable-declarator-multi-comment/expected.js +++ b/test/fixtures/generation/comments/variable-declarator-multi-comment/expected.js @@ -1,13 +1,13 @@ function test() { var - /* - * Leading to VariableDeclarator - * Leading to VariableDeclarator - */ - i = 20, - /* - * Leading to VariableDeclarator - * Leading to VariableDeclarator - */ - j = 20; + /* + * Leading to VariableDeclarator + * Leading to VariableDeclarator + */ + i = 20, + /* + * Leading to VariableDeclarator + * Leading to VariableDeclarator + */ + j = 20; } diff --git a/test/fixtures/generation/comments/variable-declarator-trailing-comment/actual.js b/test/fixtures/generation/comments/variable-declarator-trailing-comment/actual.js index 3703d0f05d..4fb0a432e0 100644 --- a/test/fixtures/generation/comments/variable-declarator-trailing-comment/actual.js +++ b/test/fixtures/generation/comments/variable-declarator-trailing-comment/actual.js @@ -1,16 +1,16 @@ { var t = 20; /* - * This is trailing comment - */ + * This is trailing comment + */ } { var tt = 20; /* - * This is trailing comment - */ + * This is trailing comment + */ } {{ var t = 20; /* - * This is trailing comment - */ + * This is trailing comment + */ }} diff --git a/test/fixtures/generation/comments/variable-declarator-trailing-comment/expected.js b/test/fixtures/generation/comments/variable-declarator-trailing-comment/expected.js index 246a9df61a..7819d36b16 100644 --- a/test/fixtures/generation/comments/variable-declarator-trailing-comment/expected.js +++ b/test/fixtures/generation/comments/variable-declarator-trailing-comment/expected.js @@ -1,20 +1,18 @@ { - var t = 20; - /* - * This is trailing comment - */ + var t = 20; /* + * This is trailing comment + */ } + { - var tt = 20; - /* - * This is trailing comment - */ + var tt = 20; /* + * This is trailing comment + */ } { { - var t = 20; - /* - * This is trailing comment - */ + var t = 20; /* + * This is trailing comment + */ } } diff --git a/test/fixtures/generation/edgecase/for-in-no-in/expected.js b/test/fixtures/generation/edgecase/for-in-no-in/expected.js index 6aa84e89ed..029b11e515 100644 --- a/test/fixtures/generation/edgecase/for-in-no-in/expected.js +++ b/test/fixtures/generation/edgecase/for-in-no-in/expected.js @@ -1,9 +1,9 @@ for (var i = (1 in []) in []); -for (var i = 1 in [] in []); +for (var i = 1 in ([] in [])); for (var i = (10 * 10 in []) in []); for (var i = (10 + 10 in []) in []); for (var i = 10 + (10 in []) in []); -for (var i = 10 + 10 in [] in []); +for (var i = 10 + 10 in ([] in [])); for (var i = (1 in []);;); for ((1 in []);;); for (1 * (1 in []);;); diff --git a/test/fixtures/generation/edgecase/new-precedence/expected.js b/test/fixtures/generation/edgecase/new-precedence/expected.js index ff626b14a2..646afe94da 100644 --- a/test/fixtures/generation/edgecase/new-precedence/expected.js +++ b/test/fixtures/generation/edgecase/new-precedence/expected.js @@ -1,9 +1,9 @@ -new (a()).b(); +new (a().b)(); new a().b(); -new (a()).b(); +new (a().b)(); new (a())(); new new a(a)(); new new a()(a); new a().test; new a().test; -new (a()).test(); +new (a().test)(); diff --git a/test/fixtures/generation/edgecase/one-property-with-line-terminator/expected.js b/test/fixtures/generation/edgecase/one-property-with-line-terminator/expected.js index 3fdcf1f86c..cfbda48a0d 100644 --- a/test/fixtures/generation/edgecase/one-property-with-line-terminator/expected.js +++ b/test/fixtures/generation/edgecase/one-property-with-line-terminator/expected.js @@ -1 +1,3 @@ -dejavu.Class.declare({ method2: function () {} }); +dejavu.Class.declare({ + method2: function () {} +}); diff --git a/test/fixtures/generation/edgecase/unnecessary-parenthesized-in-2/actual.js b/test/fixtures/generation/edgecase/unnecessary-parenthesized-in-2/actual.js deleted file mode 100644 index 89bd0be917..0000000000 --- a/test/fixtures/generation/edgecase/unnecessary-parenthesized-in-2/actual.js +++ /dev/null @@ -1,2 +0,0 @@ -var i = 1 * (2 + 0 in []); -for (var i = 1 * (2 + 0 in []) in []); diff --git a/test/fixtures/generation/edgecase/unnecessary-parenthesized-in-2/expected.js b/test/fixtures/generation/edgecase/unnecessary-parenthesized-in-2/expected.js deleted file mode 100644 index 89bd0be917..0000000000 --- a/test/fixtures/generation/edgecase/unnecessary-parenthesized-in-2/expected.js +++ /dev/null @@ -1,2 +0,0 @@ -var i = 1 * (2 + 0 in []); -for (var i = 1 * (2 + 0 in []) in []); diff --git a/test/fixtures/generation/edgecase/unnecessary-parenthesized-in/actual.js b/test/fixtures/generation/edgecase/unnecessary-parenthesized-in/actual.js deleted file mode 100644 index 9d132c597d..0000000000 --- a/test/fixtures/generation/edgecase/unnecessary-parenthesized-in/actual.js +++ /dev/null @@ -1 +0,0 @@ -var i = 0 in ["test"]; diff --git a/test/fixtures/generation/edgecase/unnecessary-parenthesized-in/expected.js b/test/fixtures/generation/edgecase/unnecessary-parenthesized-in/expected.js deleted file mode 100644 index 9d132c597d..0000000000 --- a/test/fixtures/generation/edgecase/unnecessary-parenthesized-in/expected.js +++ /dev/null @@ -1 +0,0 @@ -var i = 0 in ["test"]; diff --git a/test/fixtures/generation/harmony-edgecase/class-declaration/expected.js b/test/fixtures/generation/harmony-edgecase/class-declaration/expected.js index 339d11a071..4a2e4f4d04 100644 --- a/test/fixtures/generation/harmony-edgecase/class-declaration/expected.js +++ b/test/fixtures/generation/harmony-edgecase/class-declaration/expected.js @@ -3,25 +3,37 @@ class Derived extends Super {} class Derived2 extends Super() {} class StaticMethods { static n1() {} + static get get1() {} + static set set1(value) {} + static *gen1() {} } class Methods { n2() {} + get get2() {} + set set2(value) {} + *gen1() {} } class ComputedStaticMethods { static [n1]() {} + static get [get1]() {} + static set [set1](value) {} + static *[gen1]() {} } class ComputedMethods { [n2]() {} + get [get2]() {} + set [set2](value) {} + *[gen1]() {} } diff --git a/test/fixtures/generation/harmony-edgecase/class-expression/actual.js b/test/fixtures/generation/harmony-edgecase/class-expression/actual.js index 6c78cf466c..2172cb410d 100644 --- a/test/fixtures/generation/harmony-edgecase/class-expression/actual.js +++ b/test/fixtures/generation/harmony-edgecase/class-expression/actual.js @@ -1,7 +1,7 @@ -class Test { } -class Derived extends Super { } -class Derived2 extends Super() { } -class StaticMethods { +(class Test { }); +(class Derived extends Super { }); +(class Derived2 extends Super() { }); +(class StaticMethods { static n1() { } @@ -13,8 +13,8 @@ class StaticMethods { static *gen1() { } -} -class Methods { +}); +(class Methods { n2() { } @@ -26,8 +26,8 @@ class Methods { *gen1() { } -} -class ComputedStaticMethods { +}); +(class ComputedStaticMethods { static [n1]() { } @@ -39,8 +39,8 @@ class ComputedStaticMethods { static *[gen1]() { } -} -class ComputedMethods { +}); +(class ComputedMethods { [n2]() { } @@ -52,6 +52,6 @@ class ComputedMethods { *[gen1]() { } -} +}); (class { }); (class extends Super() { }); diff --git a/test/fixtures/generation/harmony-edgecase/class-expression/expected.js b/test/fixtures/generation/harmony-edgecase/class-expression/expected.js index 6ae2a76668..bf14e23cd5 100644 --- a/test/fixtures/generation/harmony-edgecase/class-expression/expected.js +++ b/test/fixtures/generation/harmony-edgecase/class-expression/expected.js @@ -3,26 +3,38 @@ (class Derived2 extends Super() {}); (class StaticMethods { static n1() {} + static get get1() {} + static set set1(value) {} + static *gen1() {} }); (class Methods { n2() {} + get get2() {} + set set2(value) {} + *gen1() {} }); (class ComputedStaticMethods { static [n1]() {} + static get [get1]() {} + static set [set1](value) {} + static *[gen1]() {} }); (class ComputedMethods { [n2]() {} + get [get2]() {} + set [set2](value) {} + *[gen1]() {} }); (class {}); diff --git a/test/fixtures/generation/harmony-edgecase/computed-property/expected.js b/test/fixtures/generation/harmony-edgecase/computed-property/expected.js index 24c7be1db5..f691ac68dc 100644 --- a/test/fixtures/generation/harmony-edgecase/computed-property/expected.js +++ b/test/fixtures/generation/harmony-edgecase/computed-property/expected.js @@ -2,8 +2,12 @@ var object1 = { get [Symbol.create]() {}, set [set()](value) {} }; -var object2 = { *[generator()]() {} }; -var object3 = { *[generator()]() {} }; +var object2 = { + *[generator()]() {} +}; +var object3 = { + *[generator()]() {} +}; var object4 = { [Symbol.xxx]: "hello", [ok()]: 42 diff --git a/test/fixtures/generation/harmony-edgecase/default-parameter/expected.js b/test/fixtures/generation/harmony-edgecase/default-parameter/expected.js index 2b7c5f6837..bc5604fa1b 100644 --- a/test/fixtures/generation/harmony-edgecase/default-parameter/expected.js +++ b/test/fixtures/generation/harmony-edgecase/default-parameter/expected.js @@ -1,5 +1,8 @@ function a(p = 20) {} + function b(p, q = 30) {} + function c(p, q = 30, ...r) {} + (p = 20) => {}; (p = 20, ...q) => {}; diff --git a/test/fixtures/generation/harmony-edgecase/destructuring-assignment/actual.js b/test/fixtures/generation/harmony-edgecase/destructuring-assignment/actual.js index ffd9d6df2a..b9325bbae1 100644 --- a/test/fixtures/generation/harmony-edgecase/destructuring-assignment/actual.js +++ b/test/fixtures/generation/harmony-edgecase/destructuring-assignment/actual.js @@ -5,12 +5,14 @@ function t2({responseText}) { function t3([a, b]) { } var [i, j, k] = array; -var {i, j, k} = obj; +var { + i, + j, + k +} = obj; let {i, j, k} = obj; const {i, j, k} = obj; -var { - value -} = obj; +var { value } = obj; var { value } = obj; diff --git a/test/fixtures/generation/harmony-edgecase/destructuring-assignment/expected.js b/test/fixtures/generation/harmony-edgecase/destructuring-assignment/expected.js index 3bf4a67239..d32b4e5bae 100644 --- a/test/fixtures/generation/harmony-edgecase/destructuring-assignment/expected.js +++ b/test/fixtures/generation/harmony-edgecase/destructuring-assignment/expected.js @@ -7,15 +7,9 @@ var { j, k } = obj; -let { - i, - j, - k -} = obj; -const { - i, - j, - k -} = obj; -var { value } = obj; +let { i, j, k } = obj; +const { i, j, k } = obj; var { value } = obj; +var { + value +} = obj; diff --git a/test/fixtures/generation/harmony-edgecase/for-of-statement/expected.js b/test/fixtures/generation/harmony-edgecase/for-of-statement/expected.js index a7b5693e48..be22a40333 100644 --- a/test/fixtures/generation/harmony-edgecase/for-of-statement/expected.js +++ b/test/fixtures/generation/harmony-edgecase/for-of-statement/expected.js @@ -1,4 +1,5 @@ function test() { for (var i of array) {} + for (let i of array) {} } diff --git a/test/fixtures/generation/harmony-edgecase/one-assignment-property/expected.js b/test/fixtures/generation/harmony-edgecase/one-assignment-property/expected.js index c4fab8cae7..21e61a0527 100644 --- a/test/fixtures/generation/harmony-edgecase/one-assignment-property/expected.js +++ b/test/fixtures/generation/harmony-edgecase/one-assignment-property/expected.js @@ -1,7 +1,5 @@ ({ t: t }) = obj; -({ t: { C: C } }) = obj; ({ - a, - b, - c + t: { C: C } }) = obj; +({ a, b, c }) = obj; diff --git a/test/fixtures/generation/harmony-edgecase/templates-escape/expected.js b/test/fixtures/generation/harmony-edgecase/templates-escape/expected.js index cf5574d59d..5d8a96d54f 100644 --- a/test/fixtures/generation/harmony-edgecase/templates-escape/expected.js +++ b/test/fixtures/generation/harmony-edgecase/templates-escape/expected.js @@ -2,6 +2,7 @@ var escaped = ` \u2028 \u2029 `; + var escaped = ` \v \b diff --git a/test/fixtures/generation/harmony-edgecase/templates/expected.js b/test/fixtures/generation/harmony-edgecase/templates/expected.js index 0504c05b33..93ff1e3ebb 100644 --- a/test/fixtures/generation/harmony-edgecase/templates/expected.js +++ b/test/fixtures/generation/harmony-edgecase/templates/expected.js @@ -1,21 +1,27 @@ var hello = `hello`; + var hello = ` line terminators`; + var tagged = tagged`hello`; var tagged = member.call`hello`; -var tagged = new call`hello`; -var tagged = new (call`hello`()); +var tagged = new call`hello`(); +var tagged = new (call`hello`())(); var tageed = member[call`hello`]; + var middles = ` Is the order a rabbit? `; + var middles = ` Is the order ${ order }? `; + var middles = ` Is the order ${ order }? `; + var middles = ` 1. ${ cocoa } 2. ${ chino } diff --git a/test/fixtures/transformation/array-comprehension/arguments/expected.js b/test/fixtures/transformation/array-comprehension/arguments/expected.js index b82dd052a0..d8457bb0ef 100644 --- a/test/fixtures/transformation/array-comprehension/arguments/expected.js +++ b/test/fixtures/transformation/array-comprehension/arguments/expected.js @@ -2,9 +2,10 @@ function add() { var _arguments = arguments; + return [1, 2, 3].map(function (i) { return i * _arguments[0]; }); } -add(5); \ No newline at end of file +add(5); diff --git a/test/fixtures/transformation/array-comprehension/multiple-if/expected.js b/test/fixtures/transformation/array-comprehension/multiple-if/expected.js index fb2d1c51bb..f0d8c50729 100644 --- a/test/fixtures/transformation/array-comprehension/multiple-if/expected.js +++ b/test/fixtures/transformation/array-comprehension/multiple-if/expected.js @@ -10,10 +10,7 @@ var seattlers = (function () { var c = _step2.value; if (c.city == "Seattle") { - _arr.push({ - name: c.name, - age: c.age - }); + _arr.push({ name: c.name, age: c.age }); } } } diff --git a/test/fixtures/transformation/array-comprehension/multiple/expected.js b/test/fixtures/transformation/array-comprehension/multiple/expected.js index 87291a575d..2efb3116f2 100644 --- a/test/fixtures/transformation/array-comprehension/multiple/expected.js +++ b/test/fixtures/transformation/array-comprehension/multiple/expected.js @@ -8,7 +8,6 @@ var arr = (function () { for (var _iterator2 = "12345678".split("")[Symbol.iterator](), _step2; !(_step2 = _iterator2.next()).done;) { var y = _step2.value; - _arr.push(x + y); } } diff --git a/test/fixtures/transformation/array-comprehension/this/expected.js b/test/fixtures/transformation/array-comprehension/this/expected.js index 4e26457098..c827d99fb8 100644 --- a/test/fixtures/transformation/array-comprehension/this/expected.js +++ b/test/fixtures/transformation/array-comprehension/this/expected.js @@ -2,9 +2,10 @@ function add() { var _this = this; + return [1, 2, 3].map(function (i) { return i * _this.multiplier; }); } -add.call({ multiplier: 5 }); \ No newline at end of file +add.call({ multiplier: 5 }); diff --git a/test/fixtures/transformation/arrow-functions/arguments/actual.js b/test/fixtures/transformation/arrow-functions/arguments/actual.js index 295bbe475e..bf0792d822 100644 --- a/test/fixtures/transformation/arrow-functions/arguments/actual.js +++ b/test/fixtures/transformation/arrow-functions/arguments/actual.js @@ -35,10 +35,10 @@ five({ arguments: ["foo"] }); function six(obj) { var fn = () => { - var fn2 = function () { - return arguments[0]; - }; - return fn2("foobar"); + var fn2 = function () { + return arguments[0]; + }; + return fn2("foobar"); }; return fn(); } diff --git a/test/fixtures/transformation/arrow-functions/arguments/expected.js b/test/fixtures/transformation/arrow-functions/arguments/expected.js index eab095659f..1d7acb6828 100644 --- a/test/fixtures/transformation/arrow-functions/arguments/expected.js +++ b/test/fixtures/transformation/arrow-functions/arguments/expected.js @@ -2,6 +2,7 @@ function one() { var _arguments = arguments; + var inner = function () { return _arguments; }; @@ -11,12 +12,14 @@ one(1, 2); function two() { var _arguments2 = arguments; + var inner = function () { return _arguments2; }; var another = function () { var _arguments3 = arguments; + var inner2 = function () { return _arguments3; }; @@ -28,6 +31,7 @@ two(1, 2); function three() { var _arguments4 = arguments; + var fn = function () { return _arguments4[0] + "bar"; }; @@ -37,6 +41,7 @@ three("foo"); function four() { var _arguments5 = arguments; + var fn = function () { return _arguments5[0].foo + "bar"; }; @@ -61,4 +66,4 @@ function six(obj) { }; return fn(); } -six(); \ No newline at end of file +six(); diff --git a/test/fixtures/transformation/arrow-functions/default-parameters/expected.js b/test/fixtures/transformation/arrow-functions/default-parameters/expected.js index 0fd9187e91..c0b535119d 100644 --- a/test/fixtures/transformation/arrow-functions/default-parameters/expected.js +++ b/test/fixtures/transformation/arrow-functions/default-parameters/expected.js @@ -2,7 +2,8 @@ var some = function (count) { if (count === undefined) count = "30"; + console.log("count", count); }; -some(); \ No newline at end of file +some(); diff --git a/test/fixtures/transformation/arrow-functions/nested/expected.js b/test/fixtures/transformation/arrow-functions/nested/expected.js index cba32c7b40..6ecc735707 100644 --- a/test/fixtures/transformation/arrow-functions/nested/expected.js +++ b/test/fixtures/transformation/arrow-functions/nested/expected.js @@ -1,14 +1,17 @@ "use strict"; -module.exports = { init: function () { - var _this = this; - return new Promise(function (resolve, reject) { - MongoClient.connect(config.mongodb, function (err, db) { - if (err) { - return reject(err); - } - _this.db = db; - resolve(_this); +module.exports = { + init: function () { + var _this = this; + + return new Promise(function (resolve, reject) { + MongoClient.connect(config.mongodb, function (err, db) { + if (err) { + return reject(err); + } + _this.db = db; + resolve(_this); + }); }); - }); -} }; \ No newline at end of file + } +}; diff --git a/test/fixtures/transformation/classes/accessing-super-class/expected.js b/test/fixtures/transformation/classes/accessing-super-class/expected.js index 82d2cd7de7..afe1765d12 100644 --- a/test/fixtures/transformation/classes/accessing-super-class/expected.js +++ b/test/fixtures/transformation/classes/accessing-super-class/expected.js @@ -1,19 +1,21 @@ "use strict"; var _slice = Array.prototype.slice; - var _classProps = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); + if (instanceProps) Object.defineProperties(child.prototype, instanceProps); }; var _extends = function (child, parent) { - child.prototype = Object.create(parent.prototype, { constructor: { - value: child, - enumerable: false, - writable: true, - configurable: true - } }); + child.prototype = Object.create(parent.prototype, { + constructor: { + value: child, + enumerable: false, + writable: true, + configurable: true + } + }); child.__proto__ = parent; }; @@ -33,21 +35,25 @@ var Test = (function (Foo) { _extends(Test, Foo); - _classProps(Test, { foo: { - writable: true, - value: function () { - Foo.foo.call(this); - Foo.foo.call.apply(Foo.foo, [this].concat(_slice.call(arguments))); - Foo.foo.call.apply(Foo.foo, [this, "test"].concat(_slice.call(arguments))); + _classProps(Test, { + foo: { + writable: true, + value: function () { + Foo.foo.call(this); + Foo.foo.call.apply(Foo.foo, [this].concat(_slice.call(arguments))); + Foo.foo.call.apply(Foo.foo, [this, "test"].concat(_slice.call(arguments))); + } } - } }, { test: { - writable: true, - value: function () { - Foo.prototype.test.call(this); - Foo.prototype.test.call.apply(Foo.prototype.test, [this].concat(_slice.call(arguments))); - Foo.prototype.test.call.apply(Foo.prototype.test, [this, "test"].concat(_slice.call(arguments))); + }, { + test: { + writable: true, + value: function () { + Foo.prototype.test.call(this); + Foo.prototype.test.call.apply(Foo.prototype.test, [this].concat(_slice.call(arguments))); + Foo.prototype.test.call.apply(Foo.prototype.test, [this, "test"].concat(_slice.call(arguments))); + } } - } }); + }); return Test; })(Foo); diff --git a/test/fixtures/transformation/classes/accessing-super-properties/expected.js b/test/fixtures/transformation/classes/accessing-super-properties/expected.js index 7c1ecd5407..dec479103b 100644 --- a/test/fixtures/transformation/classes/accessing-super-properties/expected.js +++ b/test/fixtures/transformation/classes/accessing-super-properties/expected.js @@ -1,12 +1,14 @@ "use strict"; var _extends = function (child, parent) { - child.prototype = Object.create(parent.prototype, { constructor: { - value: child, - enumerable: false, - writable: true, - configurable: true - } }); + child.prototype = Object.create(parent.prototype, { + constructor: { + value: child, + enumerable: false, + writable: true, + configurable: true + } + }); child.__proto__ = parent; }; @@ -19,4 +21,4 @@ var Test = (function (Foo) { _extends(Test, Foo); return Test; -})(Foo); \ No newline at end of file +})(Foo); diff --git a/test/fixtures/transformation/classes/calling-super-properties/expected.js b/test/fixtures/transformation/classes/calling-super-properties/expected.js index 4c05f44f9f..7bd4cfc56e 100644 --- a/test/fixtures/transformation/classes/calling-super-properties/expected.js +++ b/test/fixtures/transformation/classes/calling-super-properties/expected.js @@ -2,16 +2,19 @@ var _classProps = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); + if (instanceProps) Object.defineProperties(child.prototype, instanceProps); }; var _extends = function (child, parent) { - child.prototype = Object.create(parent.prototype, { constructor: { - value: child, - enumerable: false, - writable: true, - configurable: true - } }); + child.prototype = Object.create(parent.prototype, { + constructor: { + value: child, + enumerable: false, + writable: true, + configurable: true + } + }); child.__proto__ = parent; }; @@ -23,12 +26,14 @@ var Test = (function (Foo) { _extends(Test, Foo); - _classProps(Test, { test: { - writable: true, - value: function () { - return Foo.wow.call(this); + _classProps(Test, { + test: { + writable: true, + value: function () { + return Foo.wow.call(this); + } } - } }); + }); return Test; })(Foo); diff --git a/test/fixtures/transformation/classes/constructor/expected.js b/test/fixtures/transformation/classes/constructor/expected.js index a80bf4ff51..200e36b4c5 100644 --- a/test/fixtures/transformation/classes/constructor/expected.js +++ b/test/fixtures/transformation/classes/constructor/expected.js @@ -1,12 +1,14 @@ "use strict"; var _extends = function (child, parent) { - child.prototype = Object.create(parent.prototype, { constructor: { - value: child, - enumerable: false, - writable: true, - configurable: true - } }); + child.prototype = Object.create(parent.prototype, { + constructor: { + value: child, + enumerable: false, + writable: true, + configurable: true + } + }); child.__proto__ = parent; }; @@ -22,4 +24,4 @@ var Foo = (function (Bar) { _extends(Foo, Bar); return Foo; -})(Bar); \ No newline at end of file +})(Bar); diff --git a/test/fixtures/transformation/classes/instance-getter-and-setter/expected.js b/test/fixtures/transformation/classes/instance-getter-and-setter/expected.js index 4fac2f3c97..00bdae39a8 100644 --- a/test/fixtures/transformation/classes/instance-getter-and-setter/expected.js +++ b/test/fixtures/transformation/classes/instance-getter-and-setter/expected.js @@ -2,20 +2,23 @@ var _classProps = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); + if (instanceProps) Object.defineProperties(child.prototype, instanceProps); }; var Test = (function () { var Test = function Test() {}; - _classProps(Test, null, { test: { - get: function () { - return 5 + 5; - }, - set: function (val) { - this._test = val; + _classProps(Test, null, { + test: { + get: function () { + return 5 + 5; + }, + set: function (val) { + this._test = val; + } } - } }); + }); return Test; -})(); \ No newline at end of file +})(); diff --git a/test/fixtures/transformation/classes/instance-getter/expected.js b/test/fixtures/transformation/classes/instance-getter/expected.js index d4cd4e15d0..39057c75f2 100644 --- a/test/fixtures/transformation/classes/instance-getter/expected.js +++ b/test/fixtures/transformation/classes/instance-getter/expected.js @@ -2,15 +2,20 @@ var _classProps = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); + if (instanceProps) Object.defineProperties(child.prototype, instanceProps); }; var Test = (function () { var Test = function Test() {}; - _classProps(Test, null, { test: { get: function () { - return 5 + 5; - } } }); + _classProps(Test, null, { + test: { + get: function () { + return 5 + 5; + } + } + }); return Test; -})(); \ No newline at end of file +})(); diff --git a/test/fixtures/transformation/classes/instance-method/expected.js b/test/fixtures/transformation/classes/instance-method/expected.js index bff68c8b99..0e83d8bd05 100644 --- a/test/fixtures/transformation/classes/instance-method/expected.js +++ b/test/fixtures/transformation/classes/instance-method/expected.js @@ -2,18 +2,21 @@ var _classProps = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); + if (instanceProps) Object.defineProperties(child.prototype, instanceProps); }; var Test = (function () { var Test = function Test() {}; - _classProps(Test, null, { test: { - writable: true, - value: function () { - return 5 + 5; + _classProps(Test, null, { + test: { + writable: true, + value: function () { + return 5 + 5; + } } - } }); + }); return Test; -})(); \ No newline at end of file +})(); diff --git a/test/fixtures/transformation/classes/instance-setter/expected.js b/test/fixtures/transformation/classes/instance-setter/expected.js index 724bc8ee97..72cacb4828 100644 --- a/test/fixtures/transformation/classes/instance-setter/expected.js +++ b/test/fixtures/transformation/classes/instance-setter/expected.js @@ -2,15 +2,20 @@ var _classProps = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); + if (instanceProps) Object.defineProperties(child.prototype, instanceProps); }; var Test = (function () { var Test = function Test() {}; - _classProps(Test, null, { test: { set: function (val) { - this._test = val; - } } }); + _classProps(Test, null, { + test: { + set: function (val) { + this._test = val; + } + } + }); return Test; -})(); \ No newline at end of file +})(); diff --git a/test/fixtures/transformation/classes/statement/expected.js b/test/fixtures/transformation/classes/statement/expected.js index 1a31117543..5d7f938dee 100644 --- a/test/fixtures/transformation/classes/statement/expected.js +++ b/test/fixtures/transformation/classes/statement/expected.js @@ -2,6 +2,7 @@ var _classProps = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); + if (instanceProps) Object.defineProperties(child.prototype, instanceProps); }; @@ -16,12 +17,14 @@ var BaseView = function () { var BaseView = (function () { var _class2 = function () {}; - _classProps(_class2, null, { foo: { - writable: true, - value: function () { - this.autoRender = true; + _classProps(_class2, null, { + foo: { + writable: true, + value: function () { + this.autoRender = true; + } } - } }); + }); return _class2; })(); diff --git a/test/fixtures/transformation/classes/static/expected.js b/test/fixtures/transformation/classes/static/expected.js index a50fd266e8..26784ce076 100644 --- a/test/fixtures/transformation/classes/static/expected.js +++ b/test/fixtures/transformation/classes/static/expected.js @@ -2,6 +2,7 @@ var _classProps = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); + if (instanceProps) Object.defineProperties(child.prototype, instanceProps); }; diff --git a/test/fixtures/transformation/classes/super-class-id-member-expression/expected.js b/test/fixtures/transformation/classes/super-class-id-member-expression/expected.js index 1223ffc284..bce35e1528 100644 --- a/test/fixtures/transformation/classes/super-class-id-member-expression/expected.js +++ b/test/fixtures/transformation/classes/super-class-id-member-expression/expected.js @@ -1,12 +1,14 @@ "use strict"; var _extends = function (child, parent) { - child.prototype = Object.create(parent.prototype, { constructor: { - value: child, - enumerable: false, - writable: true, - configurable: true - } }); + child.prototype = Object.create(parent.prototype, { + constructor: { + value: child, + enumerable: false, + writable: true, + configurable: true + } + }); child.__proto__ = parent; }; diff --git a/test/fixtures/transformation/classes/super-class-id-non-identifiers/expected.js b/test/fixtures/transformation/classes/super-class-id-non-identifiers/expected.js index dc0c70364f..353a8c289b 100644 --- a/test/fixtures/transformation/classes/super-class-id-non-identifiers/expected.js +++ b/test/fixtures/transformation/classes/super-class-id-non-identifiers/expected.js @@ -1,12 +1,14 @@ "use strict"; var _extends = function (child, parent) { - child.prototype = Object.create(parent.prototype, { constructor: { - value: child, - enumerable: false, - writable: true, - configurable: true - } }); + child.prototype = Object.create(parent.prototype, { + constructor: { + value: child, + enumerable: false, + writable: true, + configurable: true + } + }); child.__proto__ = parent; }; @@ -18,4 +20,4 @@ var Q = (function (_ref) { _extends(Q, _ref); return Q; -})(function () {}); \ No newline at end of file +})(function () {}); diff --git a/test/fixtures/transformation/classes/super-class/expected.js b/test/fixtures/transformation/classes/super-class/expected.js index 423045d77f..c8c1fb516f 100644 --- a/test/fixtures/transformation/classes/super-class/expected.js +++ b/test/fixtures/transformation/classes/super-class/expected.js @@ -1,12 +1,14 @@ "use strict"; var _extends = function (child, parent) { - child.prototype = Object.create(parent.prototype, { constructor: { - value: child, - enumerable: false, - writable: true, - configurable: true - } }); + child.prototype = Object.create(parent.prototype, { + constructor: { + value: child, + enumerable: false, + writable: true, + configurable: true + } + }); child.__proto__ = parent; }; @@ -18,4 +20,4 @@ var Test = (function (Foo) { _extends(Test, Foo); return Test; -})(Foo); \ No newline at end of file +})(Foo); diff --git a/test/fixtures/transformation/comments/preserve-multi-line/actual.js b/test/fixtures/transformation/comments/preserve-multi-line/actual.js deleted file mode 100644 index 07c91027c9..0000000000 --- a/test/fixtures/transformation/comments/preserve-multi-line/actual.js +++ /dev/null @@ -1,5 +0,0 @@ -wow; -/* - um yeah lol -*/ -test.wow(); diff --git a/test/fixtures/transformation/comments/preserve-multi-line/expected.js b/test/fixtures/transformation/comments/preserve-multi-line/expected.js deleted file mode 100644 index 0bf997ff51..0000000000 --- a/test/fixtures/transformation/comments/preserve-multi-line/expected.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -wow; - -/* - um yeah lol -*/ - -test.wow(); \ No newline at end of file diff --git a/test/fixtures/transformation/comments/preserve-single-line/actual.js b/test/fixtures/transformation/comments/preserve-single-line/actual.js deleted file mode 100644 index 08459da466..0000000000 --- a/test/fixtures/transformation/comments/preserve-single-line/actual.js +++ /dev/null @@ -1,3 +0,0 @@ -wow; -// um yeah lol -test.wow(); diff --git a/test/fixtures/transformation/comments/preserve-single-line/expected.js b/test/fixtures/transformation/comments/preserve-single-line/expected.js deleted file mode 100644 index 07468c0c5b..0000000000 --- a/test/fixtures/transformation/comments/preserve-single-line/expected.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -wow; -// um yeah lol -test.wow(); \ No newline at end of file diff --git a/test/fixtures/transformation/constants/destructuring/expected.js b/test/fixtures/transformation/constants/destructuring/expected.js index b4d62d1385..c9b08d82ac 100644 --- a/test/fixtures/transformation/constants/destructuring/expected.js +++ b/test/fixtures/transformation/constants/destructuring/expected.js @@ -6,15 +6,9 @@ var b = _ref[1]; var _ref2 = [3, 4]; var c = _ref2[0]; var d = _ref2[1]; -var _ref3 = { - e: 5, - f: 6 -}; +var _ref3 = { e: 5, f: 6 }; var e = _ref3.e; var f = _ref3.f; -var _ref4 = { - a: 7, - b: 8 -}; +var _ref4 = { a: 7, b: 8 }; var g = _ref4.a; var h = _ref4.b; diff --git a/test/fixtures/transformation/default-parameters/multiple/expected.js b/test/fixtures/transformation/default-parameters/multiple/expected.js index c415d8c70c..50601e0826 100644 --- a/test/fixtures/transformation/default-parameters/multiple/expected.js +++ b/test/fixtures/transformation/default-parameters/multiple/expected.js @@ -2,11 +2,14 @@ var t = function (t, f) { if (f === undefined) f = 5; + if (t === undefined) t = "foo"; + return t + " bar " + f; }; var a = function (t, f) { if (f === undefined) f = 5; + return t + " bar " + f; -}; \ No newline at end of file +}; diff --git a/test/fixtures/transformation/default-parameters/single/expected.js b/test/fixtures/transformation/default-parameters/single/expected.js index 8cf069d6fc..17de701e41 100644 --- a/test/fixtures/transformation/default-parameters/single/expected.js +++ b/test/fixtures/transformation/default-parameters/single/expected.js @@ -2,5 +2,6 @@ var t = function (t) { if (t === undefined) t = "foo"; + return t + " bar"; -}; \ No newline at end of file +}; diff --git a/test/fixtures/transformation/destructuring/for-in/expected.js b/test/fixtures/transformation/destructuring/for-in/expected.js index 095e23d1b7..b11f39966e 100644 --- a/test/fixtures/transformation/destructuring/for-in/expected.js +++ b/test/fixtures/transformation/destructuring/for-in/expected.js @@ -3,5 +3,6 @@ for (var _ref in obj) { var name = _ref[0]; var value = _ref[1]; + print("Name: " + name + ", Value: " + value); -} \ No newline at end of file +} diff --git a/test/fixtures/transformation/destructuring/parameters/expected.js b/test/fixtures/transformation/destructuring/parameters/expected.js index 8685c9a6f5..6031784993 100644 --- a/test/fixtures/transformation/destructuring/parameters/expected.js +++ b/test/fixtures/transformation/destructuring/parameters/expected.js @@ -10,13 +10,11 @@ function somethingAdvanced(_ref) { function unpackObject(_ref2) { var title = _ref2.title; var author = _ref2.author; + return title + " " + author; } -console.log(unpackObject({ - title: "title", - author: "author" -})); +console.log(unpackObject({ title: "title", author: "author" })); var unpackArray = function (_ref3, _ref4) { var a = _ref3[0]; @@ -25,7 +23,8 @@ var unpackArray = function (_ref3, _ref4) { var x = _ref4[0]; var y = _ref4[1]; var z = _ref4[2]; + return a + b + c; }; -console.log(unpackArray(["hello", ", ", "world"], [1, 2, 3])); \ No newline at end of file +console.log(unpackArray(["hello", ", ", "world"], [1, 2, 3])); diff --git a/test/fixtures/transformation/jsx/everything/expected.js b/test/fixtures/transformation/jsx/everything/expected.js index a4440ed7e3..c798178588 100644 --- a/test/fixtures/transformation/jsx/everything/expected.js +++ b/test/fixtures/transformation/jsx/everything/expected.js @@ -1,3 +1,7 @@ "use strict"; -X({ "data-prop": x ? Y({ prop: 2 }) : Z(null, "\n") }); \ No newline at end of file +X({ + "data-prop": x ? Y({ + prop: 2 + }) : Z(null, "\n") +}); diff --git a/test/fixtures/transformation/jsx/self-closing-tags/expected.js b/test/fixtures/transformation/jsx/self-closing-tags/expected.js index 18cac16984..04648d4499 100644 --- a/test/fixtures/transformation/jsx/self-closing-tags/expected.js +++ b/test/fixtures/transformation/jsx/self-closing-tags/expected.js @@ -2,4 +2,6 @@ X(null); -X({ prop: "1" }); \ No newline at end of file +X({ + prop: "1" +}); diff --git a/test/fixtures/transformation/jsx/tags-with-children/expected.js b/test/fixtures/transformation/jsx/tags-with-children/expected.js index 5f3cb3bdca..7af3674f0f 100644 --- a/test/fixtures/transformation/jsx/tags-with-children/expected.js +++ b/test/fixtures/transformation/jsx/tags-with-children/expected.js @@ -1,5 +1,9 @@ "use strict"; -X({ prop: "2" }, Y(null)); +X({ + prop: "2" +}, Y(null)); -X({ prop: "2" }, Y(null), Z(null)); \ No newline at end of file +X({ + prop: "2" +}, Y(null), Z(null)); diff --git a/test/fixtures/transformation/modules-amd/exports-variable/expected.js b/test/fixtures/transformation/modules-amd/exports-variable/expected.js index ea5d29806f..b94e1dd338 100644 --- a/test/fixtures/transformation/modules-amd/exports-variable/expected.js +++ b/test/fixtures/transformation/modules-amd/exports-variable/expected.js @@ -2,20 +2,13 @@ define(["exports"], function (exports) { "use strict"; exports.foo7 = foo7; - var foo = 1; - exports.foo = foo; - var foo2 = function () {}; - exports.foo2 = foo2; + var foo = exports.foo = 1; + var foo2 = exports.foo2 = function () {}; var foo3; - exports.foo3 = foo3; - var foo4 = 2; - exports.foo4 = foo4; + var foo4 = exports.foo4 = 2; var foo5; - exports.foo5 = foo5; - var foo6 = 3; - exports.foo6 = foo6; + var foo6 = exports.foo6 = 3; function foo7() {} - var foo8 = function foo8() {}; exports.foo8 = foo8; diff --git a/test/fixtures/transformation/modules-amd/hoist-function-exports/actual.js b/test/fixtures/transformation/modules-amd/hoist-function-exports/actual.js index d0af5b7592..3c40b7d1c1 100644 --- a/test/fixtures/transformation/modules-amd/hoist-function-exports/actual.js +++ b/test/fixtures/transformation/modules-amd/hoist-function-exports/actual.js @@ -6,6 +6,6 @@ export function nextOdd(n) { export var isOdd = (function (isEven) { return function (n) { - return !isEven(n); + return !isEven(n); }; })(isEven); diff --git a/test/fixtures/transformation/modules-amd/hoist-function-exports/expected.js b/test/fixtures/transformation/modules-amd/hoist-function-exports/expected.js index c5ab9169c8..7d072c6f35 100644 --- a/test/fixtures/transformation/modules-amd/hoist-function-exports/expected.js +++ b/test/fixtures/transformation/modules-amd/hoist-function-exports/expected.js @@ -7,10 +7,9 @@ define(["exports", "./evens"], function (exports, _evens) { return isEven(n) ? n + 1 : n + 2; } - var isOdd = (function (isEven) { + var isOdd = exports.isOdd = (function (isEven) { return function (n) { return !isEven(n); }; })(isEven); - exports.isOdd = isOdd; -}); \ No newline at end of file +}); diff --git a/test/fixtures/transformation/modules-amd/overview/expected.js b/test/fixtures/transformation/modules-amd/overview/expected.js index 1ef8ac9dd3..d1d75bff1a 100644 --- a/test/fixtures/transformation/modules-amd/overview/expected.js +++ b/test/fixtures/transformation/modules-amd/overview/expected.js @@ -6,8 +6,7 @@ define(["exports", "foo", "foo-bar", "./directory/foo-bar"], function (exports, var bar = _foo.bar; var bar = _foo.foo; exports.test = test; - var test = 5; + var test = exports.test = 5; - exports.test = test; exports.default = test; -}); \ No newline at end of file +}); diff --git a/test/fixtures/transformation/modules-common/exports-variable/expected.js b/test/fixtures/transformation/modules-common/exports-variable/expected.js index 5f5bcb859b..886cf61824 100644 --- a/test/fixtures/transformation/modules-common/exports-variable/expected.js +++ b/test/fixtures/transformation/modules-common/exports-variable/expected.js @@ -1,20 +1,13 @@ "use strict"; exports.foo7 = foo7; -var foo = 1; -exports.foo = foo; -var foo2 = function () {}; -exports.foo2 = foo2; +var foo = exports.foo = 1; +var foo2 = exports.foo2 = function () {}; var foo3; -exports.foo3 = foo3; -var foo4 = 2; -exports.foo4 = foo4; +var foo4 = exports.foo4 = 2; var foo5; -exports.foo5 = foo5; -var foo6 = 3; -exports.foo6 = foo6; +var foo6 = exports.foo6 = 3; function foo7() {} - var foo8 = function foo8() {}; exports.foo8 = foo8; diff --git a/test/fixtures/transformation/modules-common/hoist-function-exports/actual.js b/test/fixtures/transformation/modules-common/hoist-function-exports/actual.js index d0af5b7592..3c40b7d1c1 100644 --- a/test/fixtures/transformation/modules-common/hoist-function-exports/actual.js +++ b/test/fixtures/transformation/modules-common/hoist-function-exports/actual.js @@ -6,6 +6,6 @@ export function nextOdd(n) { export var isOdd = (function (isEven) { return function (n) { - return !isEven(n); + return !isEven(n); }; })(isEven); diff --git a/test/fixtures/transformation/modules-common/hoist-function-exports/expected.js b/test/fixtures/transformation/modules-common/hoist-function-exports/expected.js index 1c5aa19914..5a074e1496 100644 --- a/test/fixtures/transformation/modules-common/hoist-function-exports/expected.js +++ b/test/fixtures/transformation/modules-common/hoist-function-exports/expected.js @@ -6,9 +6,8 @@ function nextOdd(n) { return isEven(n) ? n + 1 : n + 2; } -var isOdd = (function (isEven) { +var isOdd = exports.isOdd = (function (isEven) { return function (n) { return !isEven(n); }; })(isEven); -exports.isOdd = isOdd; \ No newline at end of file diff --git a/test/fixtures/transformation/modules-common/overview/expected.js b/test/fixtures/transformation/modules-common/overview/expected.js index 963c3278c3..a08e44926a 100644 --- a/test/fixtures/transformation/modules-common/overview/expected.js +++ b/test/fixtures/transformation/modules-common/overview/expected.js @@ -11,7 +11,6 @@ var foo = require("foo"); var bar = require("foo").bar; var bar = require("foo").foo; exports.test = test; -var test = 5; +var test = exports.test = 5; -exports.test = test; -exports.default = test; \ No newline at end of file +exports.default = test; diff --git a/test/fixtures/transformation/modules-umd/exports-variable/expected.js b/test/fixtures/transformation/modules-umd/exports-variable/expected.js index fab523ee41..d381823150 100644 --- a/test/fixtures/transformation/modules-umd/exports-variable/expected.js +++ b/test/fixtures/transformation/modules-umd/exports-variable/expected.js @@ -8,20 +8,13 @@ "use strict"; exports.foo7 = foo7; - var foo = 1; - exports.foo = foo; - var foo2 = function () {}; - exports.foo2 = foo2; + var foo = exports.foo = 1; + var foo2 = exports.foo2 = function () {}; var foo3; - exports.foo3 = foo3; - var foo4 = 2; - exports.foo4 = foo4; + var foo4 = exports.foo4 = 2; var foo5; - exports.foo5 = foo5; - var foo6 = 3; - exports.foo6 = foo6; + var foo6 = exports.foo6 = 3; function foo7() {} - var foo8 = function foo8() {}; exports.foo8 = foo8; diff --git a/test/fixtures/transformation/modules-umd/hoist-function-exports/actual.js b/test/fixtures/transformation/modules-umd/hoist-function-exports/actual.js index d0af5b7592..3c40b7d1c1 100644 --- a/test/fixtures/transformation/modules-umd/hoist-function-exports/actual.js +++ b/test/fixtures/transformation/modules-umd/hoist-function-exports/actual.js @@ -6,6 +6,6 @@ export function nextOdd(n) { export var isOdd = (function (isEven) { return function (n) { - return !isEven(n); + return !isEven(n); }; })(isEven); diff --git a/test/fixtures/transformation/modules-umd/hoist-function-exports/expected.js b/test/fixtures/transformation/modules-umd/hoist-function-exports/expected.js index 3543c04818..bd34bf40d1 100644 --- a/test/fixtures/transformation/modules-umd/hoist-function-exports/expected.js +++ b/test/fixtures/transformation/modules-umd/hoist-function-exports/expected.js @@ -13,10 +13,9 @@ return isEven(n) ? n + 1 : n + 2; } - var isOdd = (function (isEven) { + var isOdd = exports.isOdd = (function (isEven) { return function (n) { return !isEven(n); }; })(isEven); - exports.isOdd = isOdd; -}); \ No newline at end of file +}); diff --git a/test/fixtures/transformation/modules-umd/overview/expected.js b/test/fixtures/transformation/modules-umd/overview/expected.js index 931d12fcf0..55d4266b45 100644 --- a/test/fixtures/transformation/modules-umd/overview/expected.js +++ b/test/fixtures/transformation/modules-umd/overview/expected.js @@ -12,8 +12,7 @@ var bar = _foo.bar; var bar = _foo.foo; exports.test = test; - var test = 5; + var test = exports.test = 5; - exports.test = test; exports.default = test; -}); \ No newline at end of file +}); diff --git a/test/fixtures/transformation/property-methods-assignment/getter-and-setter/expected.js b/test/fixtures/transformation/property-methods-assignment/getter-and-setter/expected.js index ae8adf0c9a..23467f3675 100644 --- a/test/fixtures/transformation/property-methods-assignment/getter-and-setter/expected.js +++ b/test/fixtures/transformation/property-methods-assignment/getter-and-setter/expected.js @@ -1,14 +1,16 @@ "use strict"; var obj = (function (_obj) { - Object.defineProperties(_obj, { foo: { - get: function () { - return 5 + 5; - }, - set: function (value) { - this._foo = value; + Object.defineProperties(_obj, { + foo: { + get: function () { + return 5 + 5; + }, + set: function (value) { + this._foo = value; + } } - } }); + }); return _obj; -})({}); \ No newline at end of file +})({}); diff --git a/test/fixtures/transformation/property-methods-assignment/getter/expected.js b/test/fixtures/transformation/property-methods-assignment/getter/expected.js index 1691441c02..fda0188e6e 100644 --- a/test/fixtures/transformation/property-methods-assignment/getter/expected.js +++ b/test/fixtures/transformation/property-methods-assignment/getter/expected.js @@ -1,9 +1,13 @@ "use strict"; var obj = (function (_obj) { - Object.defineProperties(_obj, { foo: { get: function () { - return 5 + 5; - } } }); + Object.defineProperties(_obj, { + foo: { + get: function () { + return 5 + 5; + } + } + }); return _obj; -})({}); \ No newline at end of file +})({}); diff --git a/test/fixtures/transformation/property-methods-assignment/method/expected.js b/test/fixtures/transformation/property-methods-assignment/method/expected.js index d70e8989ac..7c847fa38b 100644 --- a/test/fixtures/transformation/property-methods-assignment/method/expected.js +++ b/test/fixtures/transformation/property-methods-assignment/method/expected.js @@ -1,5 +1,7 @@ "use strict"; -var obj = { method: function () { - return 5 + 5; -} }; \ No newline at end of file +var obj = { + method: function () { + return 5 + 5; + } +}; diff --git a/test/fixtures/transformation/property-methods-assignment/setter/expected.js b/test/fixtures/transformation/property-methods-assignment/setter/expected.js index f3ee6caefc..3320d6ee41 100644 --- a/test/fixtures/transformation/property-methods-assignment/setter/expected.js +++ b/test/fixtures/transformation/property-methods-assignment/setter/expected.js @@ -1,9 +1,13 @@ "use strict"; var obj = (function (_obj) { - Object.defineProperties(_obj, { foo: { set: function (value) { - this._foo = value; - } } }); + Object.defineProperties(_obj, { + foo: { + set: function (value) { + this._foo = value; + } + } + }); return _obj; -})({}); \ No newline at end of file +})({}); diff --git a/test/fixtures/transformation/property-name-shorthand/mixed/expected.js b/test/fixtures/transformation/property-name-shorthand/mixed/expected.js index 1ef5efb0ad..aca3a91133 100644 --- a/test/fixtures/transformation/property-name-shorthand/mixed/expected.js +++ b/test/fixtures/transformation/property-name-shorthand/mixed/expected.js @@ -1,7 +1,3 @@ "use strict"; -var coords = { - x: x, - y: y, - foo: "bar" -}; \ No newline at end of file +var coords = { x: x, y: y, foo: "bar" }; diff --git a/test/fixtures/transformation/property-name-shorthand/multiple/expected.js b/test/fixtures/transformation/property-name-shorthand/multiple/expected.js index 817c34aecd..02284f765b 100644 --- a/test/fixtures/transformation/property-name-shorthand/multiple/expected.js +++ b/test/fixtures/transformation/property-name-shorthand/multiple/expected.js @@ -1,6 +1,3 @@ "use strict"; -var coords = { - x: x, - y: y -}; \ No newline at end of file +var coords = { x: x, y: y }; diff --git a/test/fixtures/transformation/react/display-name-object-declaration/expected.js b/test/fixtures/transformation/react/display-name-object-declaration/expected.js index 6986b8ba92..3e8f1cd6c8 100644 --- a/test/fixtures/transformation/react/display-name-object-declaration/expected.js +++ b/test/fixtures/transformation/react/display-name-object-declaration/expected.js @@ -1,8 +1,10 @@ "use strict"; -exports = { Component: React.createClass({ - displayName: "Component", - render: function () { - return null; - } -}) }; \ No newline at end of file +exports = { + Component: React.createClass({ + displayName: "Component", + render: function () { + return null; + } + }) +}; diff --git a/test/fixtures/transformation/source-maps/class/expected.js b/test/fixtures/transformation/source-maps/class/expected.js index 1c7c0b2d2f..413cba0fb1 100644 --- a/test/fixtures/transformation/source-maps/class/expected.js +++ b/test/fixtures/transformation/source-maps/class/expected.js @@ -2,18 +2,23 @@ var _classProps = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); + if (instanceProps) Object.defineProperties(child.prototype, instanceProps); }; var Test = (function () { var Test = function Test() {}; - _classProps(Test, null, { bar: { get: function () { - throw new Error("wow"); - } } }); + _classProps(Test, null, { + bar: { + get: function () { + throw new Error("wow"); + } + } + }); return Test; })(); -var test = new Test; -test.bar; \ No newline at end of file +var test = new Test(); +test.bar; diff --git a/test/fixtures/transformation/source-maps/class/source-mappings.json b/test/fixtures/transformation/source-maps/class/source-mappings.json index 594ce68ed8..0bb3b62b7f 100644 --- a/test/fixtures/transformation/source-maps/class/source-mappings.json +++ b/test/fixtures/transformation/source-maps/class/source-mappings.json @@ -1,10 +1,10 @@ [{ "original": { "line": 3, - "column": 11 + "column": 10 }, "generated": { - "line": 12, - "column": 11 + "line": 15, + "column": 15 } }] diff --git a/test/generation.js b/test/generation.js index a256602202..28a59bd341 100644 --- a/test/generation.js +++ b/test/generation.js @@ -1,20 +1,20 @@ var generate = require("../lib/6to5/generator"); -var traverse = require("../lib/6to5/traverse"); var assert = require("assert"); var helper = require("./_helper"); var util = require("../lib/6to5/util"); var chai = require("chai"); +var t = require("../lib/6to5/types"); var _ = require("lodash"); suite("generation", function () { test("completeness", function () { - _.each(traverse.VISITOR_KEYS, function (keys, type) { + _.each(t.VISITOR_KEYS, function (keys, type) { assert.ok(!!generate.CodeGenerator.prototype[type], type + " should exist"); }); _.each(generate.CodeGenerator.prototype, function (fn, type) { if (!/[A-Z]/.test(type[0])) return; - assert.ok(traverse.VISITOR_KEYS[type], type + " should not exist"); + assert.ok(t.VISITOR_KEYS[type], type + " should not exist"); }); }); }); @@ -26,7 +26,7 @@ _.each(helper.get("generation"), function (testSuite) { var expect = task.expect; var actual = task.actual; - var actualAst = util.parseNoProperties(actual.loc, actual.code); + var actualAst = util.parse({ filename: actual.loc }, actual.code); var actualCode = generate(actual.code, actualAst).code; chai.expect(actualCode).to.equal(expect.code, actual.loc + " !== " + expect.loc); diff --git a/test/mocha.opts b/test/mocha.opts index c89de44e9e..3d061f3d6e 100644 --- a/test/mocha.opts +++ b/test/mocha.opts @@ -2,4 +2,3 @@ --ui tdd --check-leaks --globals regeneratorRuntime,i ---inline-diffs