on master help sign in
Add initial expected JS
commit532cdfc64e5552e25355592a7504d338478c699f authorLaszlo Pandy <laszlo.pandy@prezi.com> dateMon 31 Aug 2015, 15:17 (11 years ago) parent5efc238
15 files changed+366
tests/test-files/good-expected-js/AliasSubstitution.elm.js+19 tests/test-files/good-expected-js/NoExpressions.elm.js+14 tests/test-files/good-expected-js/Otherwise.elm.js+18 tests/test-files/good-expected-js/Ports.elm.js+74 tests/test-files/good-expected-js/PortsWithTypeAliases.elm.js+38 tests/test-files/good-expected-js/QuotesAndComments.elm.js+25 tests/test-files/good-expected-js/Soundness/Apply.elm.js+21 tests/test-files/good-expected-js/Soundness/ApplyAnnotated.elm.js+21 tests/test-files/good-expected-js/Soundness/Id.elm.js+21 tests/test-files/good-expected-js/Soundness/IdAnnotated.elm.js+21 tests/test-files/good-expected-js/Soundness/TrickyId.elm.js+19 tests/test-files/good-expected-js/Soundness/TrickyIdAnnotated.elm.js+19 tests/test-files/good-expected-js/Strings/Multiline.elm.js+16 tests/test-files/good-expected-js/Strings/MultilineNormal.elm.js+16 tests/test-files/good-expected-js/Unify/NonHomogeneousRecords.elm.js+24
tests/test-files/good-expected-js/AliasSubstitution.elm.jsnew file+19
@@ -0,0 +1,19 @@
1+Elm.Main = Elm.Main || {};
2+Elm.Main.make = function (_elm) {
3+ "use strict";
4+ _elm.Main = _elm.Main || {};
5+ if (_elm.Main.values)
6+ return _elm.Main.values;
7+ var _op = {},
8+ _N = Elm.Native,
9+ _U = _N.Utils.make(_elm),
10+ _L = _N.List.make(_elm),
11+ $moduleName = "Main";
12+ var extractVec = function (v) {
13+ return {_: {},x: v.x,y: v.y};
14+ };
15+ _elm.Main.values = {_op: _op
16+ ,Vec2Ext: Vec2Ext
17+ ,extractVec: extractVec};
18+ return _elm.Main.values;
19+};
tests/test-files/good-expected-js/NoExpressions.elm.jsnew file+14
@@ -0,0 +1,14 @@
1+Elm.Main = Elm.Main || {};
2+Elm.Main.make = function (_elm) {
3+ "use strict";
4+ _elm.Main = _elm.Main || {};
5+ if (_elm.Main.values)
6+ return _elm.Main.values;
7+ var _op = {},
8+ _N = Elm.Native,
9+ _U = _N.Utils.make(_elm),
10+ _L = _N.List.make(_elm),
11+ $moduleName = "Main";
12+ _elm.Main.values = {_op: _op};
13+ return _elm.Main.values;
14+};
tests/test-files/good-expected-js/Otherwise.elm.jsnew file+18
@@ -0,0 +1,18 @@
1+Elm.Otherwise = Elm.Otherwise || {};
2+Elm.Otherwise.make = function (_elm) {
3+ "use strict";
4+ _elm.Otherwise = _elm.Otherwise || {};
5+ if (_elm.Otherwise.values)
6+ return _elm.Otherwise.values;
7+ var _op = {},
8+ _N = Elm.Native,
9+ _U = _N.Utils.make(_elm),
10+ _L = _N.List.make(_elm),
11+ $moduleName = "Otherwise";
12+ var boo = false ? "Yay" : "Boo";
13+ var otherwise = 3;
14+ _elm.Otherwise.values = {_op: _op
15+ ,otherwise: otherwise
16+ ,boo: boo};
17+ return _elm.Otherwise.values;
18+};
tests/test-files/good-expected-js/Ports.elm.jsnew file+74
@@ -0,0 +1,74 @@
1+Elm.Main = Elm.Main || {};
2+Elm.Main.make = function (_elm) {
3+ "use strict";
4+ _elm.Main = _elm.Main || {};
5+ if (_elm.Main.values)
6+ return _elm.Main.values;
7+ var _op = {},
8+ _N = Elm.Native,
9+ _U = _N.Utils.make(_elm),
10+ _L = _N.List.make(_elm),
11+ $moduleName = "Main";
12+ var students = Elm.Native.Port.make(_elm).outbound("students",
13+ function (v) {
14+ return Elm.Native.List.make(_elm).toArray(v).map(function (v) {
15+ return {name: v.name
16+ ,age: v.age};
17+ });
18+ },
19+ _L.fromArray([{_: {}
20+ ,age: 42
21+ ,name: "Tom"}]));
22+ var time = Elm.Native.Port.make(_elm).outbound("time",
23+ function (v) {
24+ return v;
25+ },
26+ 3.14);
27+ var fortyTwo = Elm.Native.Port.make(_elm).outbound("fortyTwo",
28+ function (v) {
29+ return v;
30+ },
31+ 42);
32+ var record = Elm.Native.Port.make(_elm).inbound("record",
33+ "{ x : Float, y : Float }",
34+ function (v) {
35+ return typeof v === "object" && "x" in v && "y" in v ? {_: {}
36+ ,x: typeof v.x === "number" ? v.x : _U.badPort("a number",
37+ v.x)
38+ ,y: typeof v.y === "number" ? v.y : _U.badPort("a number",
39+ v.y)} : _U.badPort("an object with fields `x`, `y`",
40+ v);
41+ });
42+ var array = Elm.Native.Port.make(_elm).inbound("array",
43+ "List Int",
44+ function (v) {
45+ return typeof v === "object" && v instanceof Array ? Elm.Native.List.make(_elm).fromArray(v.map(function (v) {
46+ return typeof v === "number" ? v : _U.badPort("a number",
47+ v);
48+ })) : _U.badPort("an array",v);
49+ });
50+ var tuple = Elm.Native.Port.make(_elm).inbound("tuple",
51+ "(Float, Bool)",
52+ function (v) {
53+ return typeof v === "object" && v instanceof Array ? {ctor: "_Tuple2"
54+ ,_0: typeof v[0] === "number" ? v[0] : _U.badPort("a number",
55+ v[0])
56+ ,_1: typeof v[1] === "boolean" ? v[1] : _U.badPort("a boolean (true or false)",
57+ v[1])} : _U.badPort("an array",
58+ v);
59+ });
60+ var number = Elm.Native.Port.make(_elm).inbound("number",
61+ "Int",
62+ function (v) {
63+ return typeof v === "number" ? v : _U.badPort("a number",
64+ v);
65+ });
66+ var userID = Elm.Native.Port.make(_elm).inbound("userID",
67+ "String",
68+ function (v) {
69+ return typeof v === "string" || typeof v === "object" && v instanceof String ? v : _U.badPort("a string",
70+ v);
71+ });
72+ _elm.Main.values = {_op: _op};
73+ return _elm.Main.values;
74+};
tests/test-files/good-expected-js/PortsWithTypeAliases.elm.jsnew file+38
@@ -0,0 +1,38 @@
1+Elm.Main = Elm.Main || {};
2+Elm.Main.make = function (_elm) {
3+ "use strict";
4+ _elm.Main = _elm.Main || {};
5+ if (_elm.Main.values)
6+ return _elm.Main.values;
7+ var _op = {},
8+ _N = Elm.Native,
9+ _U = _N.Utils.make(_elm),
10+ _L = _N.List.make(_elm),
11+ $moduleName = "Main";
12+ var pairs = Elm.Native.Port.make(_elm).inbound("pairs",
13+ "Main.Point String String",
14+ function (v) {
15+ return typeof v === "object" && "x" in v && "y" in v ? {_: {}
16+ ,x: typeof v.x === "string" || typeof v.x === "object" && v.x instanceof String ? v.x : _U.badPort("a string",
17+ v.x)
18+ ,y: typeof v.y === "string" || typeof v.y === "object" && v.y instanceof String ? v.y : _U.badPort("a string",
19+ v.y)} : _U.badPort("an object with fields `x`, `y`",
20+ v);
21+ });
22+ var points = Elm.Native.Port.make(_elm).inbound("points",
23+ "Main.Point2D",
24+ function (v) {
25+ return typeof v === "object" && "x" in v && "y" in v ? {_: {}
26+ ,x: typeof v.x === "number" ? v.x : _U.badPort("a number",
27+ v.x)
28+ ,y: typeof v.y === "number" ? v.y : _U.badPort("a number",
29+ v.y)} : _U.badPort("an object with fields `x`, `y`",
30+ v);
31+ });
32+ var Point = F2(function (a,b) {
33+ return {_: {},x: a,y: b};
34+ });
35+ _elm.Main.values = {_op: _op
36+ ,Point: Point};
37+ return _elm.Main.values;
38+};
tests/test-files/good-expected-js/QuotesAndComments.elm.jsnew file+25
@@ -0,0 +1,25 @@
1+Elm.Main = Elm.Main || {};
2+Elm.Main.make = function (_elm) {
3+ "use strict";
4+ _elm.Main = _elm.Main || {};
5+ if (_elm.Main.values)
6+ return _elm.Main.values;
7+ var _op = {},
8+ _N = Elm.Native,
9+ _U = _N.Utils.make(_elm),
10+ _L = _N.List.make(_elm),
11+ $moduleName = "Main";
12+ var commentStart = "{-";
13+ var singleQuote = _U.chr("\'");
14+ var doubleQuote = _U.chr("\"");
15+ var variablesWithPrimes = function (x) {
16+ var x$ = x;
17+ return x$;
18+ };
19+ _elm.Main.values = {_op: _op
20+ ,variablesWithPrimes: variablesWithPrimes
21+ ,doubleQuote: doubleQuote
22+ ,singleQuote: singleQuote
23+ ,commentStart: commentStart};
24+ return _elm.Main.values;
25+};
tests/test-files/good-expected-js/Soundness/Apply.elm.jsnew file+21
@@ -0,0 +1,21 @@
1+Elm.Main = Elm.Main || {};
2+Elm.Main.make = function (_elm) {
3+ "use strict";
4+ _elm.Main = _elm.Main || {};
5+ if (_elm.Main.values)
6+ return _elm.Main.values;
7+ var _op = {},
8+ _N = Elm.Native,
9+ _U = _N.Utils.make(_elm),
10+ _L = _N.List.make(_elm),
11+ $moduleName = "Main";
12+ var apply = function (f) {
13+ var g = function (x) {
14+ return f(x);
15+ };
16+ return g;
17+ };
18+ _elm.Main.values = {_op: _op
19+ ,apply: apply};
20+ return _elm.Main.values;
21+};
tests/test-files/good-expected-js/Soundness/ApplyAnnotated.elm.jsnew file+21
@@ -0,0 +1,21 @@
1+Elm.Main = Elm.Main || {};
2+Elm.Main.make = function (_elm) {
3+ "use strict";
4+ _elm.Main = _elm.Main || {};
5+ if (_elm.Main.values)
6+ return _elm.Main.values;
7+ var _op = {},
8+ _N = Elm.Native,
9+ _U = _N.Utils.make(_elm),
10+ _L = _N.List.make(_elm),
11+ $moduleName = "Main";
12+ var apply = function (f) {
13+ var g = function (x) {
14+ return f(x);
15+ };
16+ return g;
17+ };
18+ _elm.Main.values = {_op: _op
19+ ,apply: apply};
20+ return _elm.Main.values;
21+};
tests/test-files/good-expected-js/Soundness/Id.elm.jsnew file+21
@@ -0,0 +1,21 @@
1+Elm.Main = Elm.Main || {};
2+Elm.Main.make = function (_elm) {
3+ "use strict";
4+ _elm.Main = _elm.Main || {};
5+ if (_elm.Main.values)
6+ return _elm.Main.values;
7+ var _op = {},
8+ _N = Elm.Native,
9+ _U = _N.Utils.make(_elm),
10+ _L = _N.List.make(_elm),
11+ $moduleName = "Main";
12+ var myId = function () {
13+ var id = function (x) {
14+ return x;
15+ };
16+ return id;
17+ }();
18+ _elm.Main.values = {_op: _op
19+ ,myId: myId};
20+ return _elm.Main.values;
21+};
tests/test-files/good-expected-js/Soundness/IdAnnotated.elm.jsnew file+21
@@ -0,0 +1,21 @@
1+Elm.Main = Elm.Main || {};
2+Elm.Main.make = function (_elm) {
3+ "use strict";
4+ _elm.Main = _elm.Main || {};
5+ if (_elm.Main.values)
6+ return _elm.Main.values;
7+ var _op = {},
8+ _N = Elm.Native,
9+ _U = _N.Utils.make(_elm),
10+ _L = _N.List.make(_elm),
11+ $moduleName = "Main";
12+ var myId = function () {
13+ var id = function (x) {
14+ return x;
15+ };
16+ return id;
17+ }();
18+ _elm.Main.values = {_op: _op
19+ ,myId: myId};
20+ return _elm.Main.values;
21+};
tests/test-files/good-expected-js/Soundness/TrickyId.elm.jsnew file+19
@@ -0,0 +1,19 @@
1+Elm.Main = Elm.Main || {};
2+Elm.Main.make = function (_elm) {
3+ "use strict";
4+ _elm.Main = _elm.Main || {};
5+ if (_elm.Main.values)
6+ return _elm.Main.values;
7+ var _op = {},
8+ _N = Elm.Native,
9+ _U = _N.Utils.make(_elm),
10+ _L = _N.List.make(_elm),
11+ $moduleName = "Main";
12+ var myId = function (x) {
13+ var y = x;
14+ return y;
15+ };
16+ _elm.Main.values = {_op: _op
17+ ,myId: myId};
18+ return _elm.Main.values;
19+};
tests/test-files/good-expected-js/Soundness/TrickyIdAnnotated.elm.jsnew file+19
@@ -0,0 +1,19 @@
1+Elm.Main = Elm.Main || {};
2+Elm.Main.make = function (_elm) {
3+ "use strict";
4+ _elm.Main = _elm.Main || {};
5+ if (_elm.Main.values)
6+ return _elm.Main.values;
7+ var _op = {},
8+ _N = Elm.Native,
9+ _U = _N.Utils.make(_elm),
10+ _L = _N.List.make(_elm),
11+ $moduleName = "Main";
12+ var myId = function (x) {
13+ var y = x;
14+ return y;
15+ };
16+ _elm.Main.values = {_op: _op
17+ ,myId: myId};
18+ return _elm.Main.values;
19+};
tests/test-files/good-expected-js/Strings/Multiline.elm.jsnew file+16
@@ -0,0 +1,16 @@
1+Elm.Main = Elm.Main || {};
2+Elm.Main.make = function (_elm) {
3+ "use strict";
4+ _elm.Main = _elm.Main || {};
5+ if (_elm.Main.values)
6+ return _elm.Main.values;
7+ var _op = {},
8+ _N = Elm.Native,
9+ _U = _N.Utils.make(_elm),
10+ _L = _N.List.make(_elm),
11+ $moduleName = "Main";
12+ var s = "\nhere\'s a quote: \"\n\n";
13+ _elm.Main.values = {_op: _op
14+ ,s: s};
15+ return _elm.Main.values;
16+};
tests/test-files/good-expected-js/Strings/MultilineNormal.elm.jsnew file+16
@@ -0,0 +1,16 @@
1+Elm.Main = Elm.Main || {};
2+Elm.Main.make = function (_elm) {
3+ "use strict";
4+ _elm.Main = _elm.Main || {};
5+ if (_elm.Main.values)
6+ return _elm.Main.values;
7+ var _op = {},
8+ _N = Elm.Native,
9+ _U = _N.Utils.make(_elm),
10+ _L = _N.List.make(_elm),
11+ $moduleName = "Main";
12+ var s = "\nhere\'s a quote: \"\n\n";
13+ _elm.Main.values = {_op: _op
14+ ,s: s};
15+ return _elm.Main.values;
16+};
tests/test-files/good-expected-js/Unify/NonHomogeneousRecords.elm.jsnew file+24
@@ -0,0 +1,24 @@
1+Elm.Main = Elm.Main || {};
2+Elm.Main.make = function (_elm) {
3+ "use strict";
4+ _elm.Main = _elm.Main || {};
5+ if (_elm.Main.values)
6+ return _elm.Main.values;
7+ var _op = {},
8+ _N = Elm.Native,
9+ _U = _N.Utils.make(_elm),
10+ _L = _N.List.make(_elm),
11+ $moduleName = "Main";
12+ var f = function (t) {
13+ var y = t.y;
14+ var x = t.x;
15+ return t;
16+ };
17+ var Thing = F2(function (a,b) {
18+ return {_: {},x: a,y: b};
19+ });
20+ _elm.Main.values = {_op: _op
21+ ,Thing: Thing
22+ ,f: f};
23+ return _elm.Main.values;
24+};