From dce41bb9897d71868a6e25138fe9255bd751f6d3 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sun, 9 Nov 2014 12:09:59 +1100 Subject: [PATCH] fix up tests --- test/fixtures/generation/basic/arrays/actual.js | 1 + test/fixtures/generation/basic/arrays/expected.js | 1 + .../comments/return-no-argument/expected.js | 4 ++-- .../variable-declarator-trailing-comment/actual.js | 12 ++++++------ .../edgecase/bitwise-precedence/expected.js | 2 +- .../generation/edgecase/floating-point/expected.js | 2 +- .../generation/edgecase/for-in-no-in/expected.js | 6 +++--- .../generation/edgecase/new-precedence/expected.js | 10 +++++----- .../edgecase/variable-declaration/expected.js | 4 ++-- .../array-comprehension/multiple/actual.js | 2 +- .../constants/destructuring/expected.js | 2 ++ .../transformation/jsx/expressions/expected.js | 8 ++++---- .../transformation/jsx/self-closing-tags/expected.js | 6 +++--- .../jsx/tags-with-children/expected.js | 8 ++++---- .../jsx/tags-with-literals/expected.js | 8 ++++---- .../modules-amd/exports-default/expected.js | 3 +-- .../modules-common/exports-default/expected.js | 3 +-- .../modules-common/imports/expected.js | 2 +- .../modules-common/overview/expected.js | 3 --- .../modules-umd/exports-default/expected.js | 3 +-- .../modules-umd/exports-from/expected.js | 2 +- .../transformation/modules-umd/overview/expected.js | 1 - .../transformation/source-maps/full/source-map.json | 2 +- .../transformation/source-maps/inline/expected.js | 2 +- 24 files changed, 47 insertions(+), 50 deletions(-) diff --git a/test/fixtures/generation/basic/arrays/actual.js b/test/fixtures/generation/basic/arrays/actual.js index e69de29bb2..cce578b089 100644 --- a/test/fixtures/generation/basic/arrays/actual.js +++ b/test/fixtures/generation/basic/arrays/actual.js @@ -0,0 +1 @@ +var foo = [1, 2, 3]; diff --git a/test/fixtures/generation/basic/arrays/expected.js b/test/fixtures/generation/basic/arrays/expected.js index e69de29bb2..cce578b089 100644 --- a/test/fixtures/generation/basic/arrays/expected.js +++ b/test/fixtures/generation/basic/arrays/expected.js @@ -0,0 +1 @@ +var foo = [1, 2, 3]; diff --git a/test/fixtures/generation/comments/return-no-argument/expected.js b/test/fixtures/generation/comments/return-no-argument/expected.js index 0dc96b3a8c..53ec5206b8 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 () { +(function() { return; // comment -})(); +}()); 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 4fb0a432e0..4ae8f0b59d 100644 --- a/test/fixtures/generation/comments/variable-declarator-trailing-comment/actual.js +++ b/test/fixtures/generation/comments/variable-declarator-trailing-comment/actual.js @@ -5,12 +5,12 @@ } { - var tt = 20; /* - * This is trailing comment - */ -} -{{ - var t = 20; /* + var tt = 20; /* * This is trailing comment */ +} +{{ + var t = 20; /* + * This is trailing comment + */ }} diff --git a/test/fixtures/generation/edgecase/bitwise-precedence/expected.js b/test/fixtures/generation/edgecase/bitwise-precedence/expected.js index ffcf91adde..7c6969bfc8 100644 --- a/test/fixtures/generation/edgecase/bitwise-precedence/expected.js +++ b/test/fixtures/generation/edgecase/bitwise-precedence/expected.js @@ -1,3 +1,3 @@ x | y ^ z; -x | y ^ z; +x | (y ^ z); (x | y) ^ z; diff --git a/test/fixtures/generation/edgecase/floating-point/expected.js b/test/fixtures/generation/edgecase/floating-point/expected.js index 14d181f975..b38eebf513 100644 --- a/test/fixtures/generation/edgecase/floating-point/expected.js +++ b/test/fixtures/generation/edgecase/floating-point/expected.js @@ -1,2 +1,2 @@ -(1.1).valueOf(); +1.1.valueOf(); (1e+300).valueOf(); 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 029b11e515..f84b95ae6b 100644 --- a/test/fixtures/generation/edgecase/for-in-no-in/expected.js +++ b/test/fixtures/generation/edgecase/for-in-no-in/expected.js @@ -1,12 +1,12 @@ 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 []);;); for (1 * (1 + 1 in []);;); -for (1 * (1 + 1 in []);;); +for (1 * ((1 + 1) in []);;); for (1 * (1 + (1 in []));;); diff --git a/test/fixtures/generation/edgecase/new-precedence/expected.js b/test/fixtures/generation/edgecase/new-precedence/expected.js index 646afe94da..7100c69c3d 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())(); new new a(a)(); -new new a()(a); -new a().test; -new a().test; -new (a().test)(); +new (new a())(a); +(new a()).test; +(new a().test); +(new (a().test)()); diff --git a/test/fixtures/generation/edgecase/variable-declaration/expected.js b/test/fixtures/generation/edgecase/variable-declaration/expected.js index 0af0dd6ac0..12407627ec 100644 --- a/test/fixtures/generation/edgecase/variable-declaration/expected.js +++ b/test/fixtures/generation/edgecase/variable-declaration/expected.js @@ -1,4 +1,4 @@ -var fact5 = (function fact(n) { +var fact5 = function fact(n) { if (n <= 1) return 1; return n * fact(n - 1); -})(5); +}(5); diff --git a/test/fixtures/transformation/array-comprehension/multiple/actual.js b/test/fixtures/transformation/array-comprehension/multiple/actual.js index 2928479d70..f0aaa63c27 100644 --- a/test/fixtures/transformation/array-comprehension/multiple/actual.js +++ b/test/fixtures/transformation/array-comprehension/multiple/actual.js @@ -1 +1 @@ -var arr = [for (x of "abcdefgh".split("")) for (y of "12345678".split("")) (x + y)]; +var arr = [for (x of "abcdefgh".split("")) for (y of "12345678".split("")) x + y]; diff --git a/test/fixtures/transformation/constants/destructuring/expected.js b/test/fixtures/transformation/constants/destructuring/expected.js index c9b08d82ac..f26c7f1481 100644 --- a/test/fixtures/transformation/constants/destructuring/expected.js +++ b/test/fixtures/transformation/constants/destructuring/expected.js @@ -1,9 +1,11 @@ "use strict"; var _ref = [1, 2]; + var a = _ref[0]; var b = _ref[1]; var _ref2 = [3, 4]; + var c = _ref2[0]; var d = _ref2[1]; var _ref3 = { e: 5, f: 6 }; diff --git a/test/fixtures/transformation/jsx/expressions/expected.js b/test/fixtures/transformation/jsx/expressions/expected.js index a7ab72bd9c..9f944f9051 100644 --- a/test/fixtures/transformation/jsx/expressions/expected.js +++ b/test/fixtures/transformation/jsx/expressions/expected.js @@ -1,10 +1,10 @@ "use strict"; -X(null, a); +(X(null, a)); -X(null, a, " ", b); +(X(null, a, " ", b)); -X({ +(X({ prop: a, yes: true -}); \ No newline at end of file +})); diff --git a/test/fixtures/transformation/jsx/self-closing-tags/expected.js b/test/fixtures/transformation/jsx/self-closing-tags/expected.js index 04648d4499..9ba9c59036 100644 --- a/test/fixtures/transformation/jsx/self-closing-tags/expected.js +++ b/test/fixtures/transformation/jsx/self-closing-tags/expected.js @@ -1,7 +1,7 @@ "use strict"; -X(null); +(X(null)); -X({ +(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 7af3674f0f..13d7a21122 100644 --- a/test/fixtures/transformation/jsx/tags-with-children/expected.js +++ b/test/fixtures/transformation/jsx/tags-with-children/expected.js @@ -1,9 +1,9 @@ "use strict"; -X({ +(X({ prop: "2" -}, Y(null)); +}, Y(null))); -X({ +(X({ prop: "2" -}, Y(null), Z(null)); +}, Y(null), Z(null))); diff --git a/test/fixtures/transformation/jsx/tags-with-literals/expected.js b/test/fixtures/transformation/jsx/tags-with-literals/expected.js index 60330adaee..e6e7dcb074 100644 --- a/test/fixtures/transformation/jsx/tags-with-literals/expected.js +++ b/test/fixtures/transformation/jsx/tags-with-literals/expected.js @@ -1,9 +1,9 @@ "use strict"; -X(null, " "); +(X(null, " ")); -X(null, "\n"); +(X(null, "\n")); -X(null, "\n string\n"); +(X(null, "\n string\n")); -X(null, "\n string\n string\n "); \ No newline at end of file +(X(null, "\n string\n string\n ")); diff --git a/test/fixtures/transformation/modules-amd/exports-default/expected.js b/test/fixtures/transformation/modules-amd/exports-default/expected.js index 91445ddaa7..48f834e265 100644 --- a/test/fixtures/transformation/modules-amd/exports-default/expected.js +++ b/test/fixtures/transformation/modules-amd/exports-default/expected.js @@ -9,8 +9,7 @@ define(["exports"], function (exports) { exports.default = function () {}; function foo() {} exports.default = foo; - - function Foo() {} + var Foo = function Foo() {}; exports.default = Foo; }); diff --git a/test/fixtures/transformation/modules-common/exports-default/expected.js b/test/fixtures/transformation/modules-common/exports-default/expected.js index cc26299189..a5bcc21f03 100644 --- a/test/fixtures/transformation/modules-common/exports-default/expected.js +++ b/test/fixtures/transformation/modules-common/exports-default/expected.js @@ -8,7 +8,6 @@ exports.default = function () {}; exports.default = function () {}; function foo() {} exports.default = foo; - -function Foo() {} +var Foo = function Foo() {}; exports.default = Foo; diff --git a/test/fixtures/transformation/modules-common/imports/expected.js b/test/fixtures/transformation/modules-common/imports/expected.js index 2c7c1b2e87..f1a139f51a 100644 --- a/test/fixtures/transformation/modules-common/imports/expected.js +++ b/test/fixtures/transformation/modules-common/imports/expected.js @@ -4,4 +4,4 @@ require("foo"); require("foo-bar"); -require("./directory/foo-bar"); \ No newline at end of file +require("./directory/foo-bar"); diff --git a/test/fixtures/transformation/modules-common/overview/expected.js b/test/fixtures/transformation/modules-common/overview/expected.js index 435c7dc9bd..d69bba69fd 100644 --- a/test/fixtures/transformation/modules-common/overview/expected.js +++ b/test/fixtures/transformation/modules-common/overview/expected.js @@ -7,13 +7,10 @@ require("foo-bar"); require("./directory/foo-bar"); var foo = require("foo").default; - var foo = require("foo"); var bar = require("foo").bar; - var bar = require("foo").foo; - exports.test = test; var test = exports.test = 5; diff --git a/test/fixtures/transformation/modules-umd/exports-default/expected.js b/test/fixtures/transformation/modules-umd/exports-default/expected.js index 3f907d9ad1..7fc8a6a267 100644 --- a/test/fixtures/transformation/modules-umd/exports-default/expected.js +++ b/test/fixtures/transformation/modules-umd/exports-default/expected.js @@ -15,8 +15,7 @@ exports.default = function () {}; function foo() {} exports.default = foo; - - function Foo() {} + var Foo = function Foo() {}; exports.default = Foo; }); diff --git a/test/fixtures/transformation/modules-umd/exports-from/expected.js b/test/fixtures/transformation/modules-umd/exports-from/expected.js index a181d838a9..af9fc6b90c 100644 --- a/test/fixtures/transformation/modules-umd/exports-from/expected.js +++ b/test/fixtures/transformation/modules-umd/exports-from/expected.js @@ -20,4 +20,4 @@ exports.default = _foo.foo; exports.default = _foo.foo; exports.bar = _foo.bar; -}); \ 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 3022551848..55d4266b45 100644 --- a/test/fixtures/transformation/modules-umd/overview/expected.js +++ b/test/fixtures/transformation/modules-umd/overview/expected.js @@ -11,7 +11,6 @@ var foo = _foo; var bar = _foo.bar; var bar = _foo.foo; - exports.test = test; var test = exports.test = 5; diff --git a/test/fixtures/transformation/source-maps/full/source-map.json b/test/fixtures/transformation/source-maps/full/source-map.json index c56d653edf..81d70ba9d8 100644 --- a/test/fixtures/transformation/source-maps/full/source-map.json +++ b/test/fixtures/transformation/source-maps/full/source-map.json @@ -3,6 +3,6 @@ "file": "source-maps/full/expected.js", "sources": ["source-maps/full/actual.js"], "names": [], - "mappings": "AAAA;;AAAA,GAAG,CAAC,GAAG,CAAC,UAAA,CAAC;SAAI,CAAC,GAAG,CAAC;CAAA,CAAC,CAAC", + "mappings": ";;AAAA,GAAG,CAAC,GAAG,CAAC,UAAA,CAAC;SAAI,CAAC,GAAG,CAAC;CAAA,CAAC,CAAC", "sourcesContent": ["arr.map(x => x * x);"] } diff --git a/test/fixtures/transformation/source-maps/inline/expected.js b/test/fixtures/transformation/source-maps/inline/expected.js index 8f27163993..ade09104cb 100644 --- a/test/fixtures/transformation/source-maps/inline/expected.js +++ b/test/fixtures/transformation/source-maps/inline/expected.js @@ -3,4 +3,4 @@ arr.map(function (x) { return x * x; }); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNvdXJjZS1tYXBzL2lubGluZS9hY3R1YWwuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0FBQUEsR0FBRyxDQUFDLEdBQUcsQ0FBQyxVQUFBLENBQUM7U0FBSSxDQUFDLEdBQUcsQ0FBQztDQUFBLENBQUMsQ0FBQyIsImZpbGUiOiJzb3VyY2UtbWFwcy9pbmxpbmUvZXhwZWN0ZWQuanMiLCJzb3VyY2VzQ29udGVudCI6WyJhcnIubWFwKHggPT4geCAqIHgpOyJdfQ== +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNvdXJjZS1tYXBzL2lubGluZS9hY3R1YWwuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxHQUFHLENBQUMsR0FBRyxDQUFDLFVBQUEsQ0FBQztTQUFJLENBQUMsR0FBRyxDQUFDO0NBQUEsQ0FBQyxDQUFDIiwiZmlsZSI6InNvdXJjZS1tYXBzL2lubGluZS9leHBlY3RlZC5qcyIsInNvdXJjZXNDb250ZW50IjpbImFyci5tYXAoeCA9PiB4ICogeCk7Il19