@@ -11,16 +11,12 @@ defmodule ElixirScript.Translator.With.Test do
1111 end
1212
1313 js_code = """
14- Bootstrap.Core.SpecialForms._with([Bootstrap.Core.Patterns.type(Bootstrap.Core.Tuple,{
15- values: [Symbol.for('ok'), Bootstrap.Core.Patterns.variable()]
16- }), function() {
17- return Elixir.ElixirScript.Map.__load(Elixir).fetch(opts,Symbol.for('width'));
18- }],[Bootstrap.Core.Patterns.type(Bootstrap.Core.Tuple,{
19- values: [Symbol.for('ok'), Bootstrap.Core.Patterns.variable()]
20- }), function(width) {
21- return Elixir.ElixirScript.Map.__load(Elixir).fetch(opts,Symbol.for('height'));
22- }],function(width,height) {
23- return new Bootstrap.Core.Tuple(Symbol.for('ok'),width * height);
14+ Bootstrap.Core.SpecialForms._with([new Bootstrap.Core.Tuple(Symbol.for('ok'), Bootstrap.Core.Patterns.variable()), function() {
15+ return Elixir.ElixirScript.Map.__load(Elixir).fetch(opts, Symbol.for('width'));
16+ }], [new Bootstrap.Core.Tuple(Symbol.for('ok'), Bootstrap.Core.Patterns.variable()), function(width) {
17+ return Elixir.ElixirScript.Map.__load(Elixir).fetch(opts, Symbol.for('height'));
18+ }], function(width, height) {
19+ return new Bootstrap.Core.Tuple(Symbol.for('ok'), width * height);
2420 })
2521 """
2622
@@ -37,18 +33,14 @@ defmodule ElixirScript.Translator.With.Test do
3733 end
3834
3935 js_code = """
40- Bootstrap.Core.SpecialForms._with([Bootstrap.Core.Patterns.type(Bootstrap.Core.Tuple,{
41- values: [Symbol.for('ok'), Bootstrap.Core.Patterns.variable()]
42- }), function() {
43- return Elixir.ElixirScript.Map.__load(Elixir).fetch(opts,Symbol.for('width'));
44- }],[Bootstrap.Core.Patterns.variable(), function(width) {
45- return width * 2;
46- }],[Bootstrap.Core.Patterns.type(Bootstrap.Core.Tuple,{
47- values: [Symbol.for('ok'), Bootstrap.Core.Patterns.variable()]
48- }), function(width,double_width) {
49- return Elixir.ElixirScript.Map.__load(Elixir).fetch(opts,Symbol.for('height'));
50- }],function(width,double_width,height) {
51- return new Bootstrap.Core.Tuple(Symbol.for('ok'),double_width * height);
36+ Bootstrap.Core.SpecialForms._with([new Bootstrap.Core.Tuple(Symbol.for('ok'), Bootstrap.Core.Patterns.variable()), function() {
37+ return Elixir.ElixirScript.Map.__load(Elixir).fetch(opts, Symbol.for('width'));
38+ }], [Bootstrap.Core.Patterns.variable(), function(width) {
39+ return width * 2;
40+ }], [new Bootstrap.Core.Tuple(Symbol.for('ok'), Bootstrap.Core.Patterns.variable()), function(width, double_width) {
41+ return Elixir.ElixirScript.Map.__load(Elixir).fetch(opts, Symbol.for('height'));
42+ }], function(width, double_width, height) {
43+ return new Bootstrap.Core.Tuple(Symbol.for('ok'), double_width * height);
5244 })
5345 """
5446
@@ -67,19 +59,15 @@ defmodule ElixirScript.Translator.With.Test do
6759 end
6860
6961 js_code = """
70- Bootstrap.Core.SpecialForms._with([Bootstrap.Core.Patterns.type(Bootstrap.Core.Tuple,{
71- values: [Symbol.for('ok'), Bootstrap.Core.Patterns.variable()]
72- }), function() {
73- return Elixir.ElixirScript.Map.__load(Elixir).fetch(opts,Symbol.for('width'));
74- }],[Bootstrap.Core.Patterns.type(Bootstrap.Core.Tuple,{
75- values: [Symbol.for('ok'), Bootstrap.Core.Patterns.variable()]
76- }), function(width) {
77- return Elixir.ElixirScript.Map.__load(Elixir).fetch(opts,Symbol.for('height'));
78- }],function(width,height) {
79- return new Bootstrap.Core.Tuple(Symbol.for('ok'),width * height);
80- },Bootstrap.Core.Patterns.defmatch(Bootstrap.Core.Patterns.clause([Symbol.for('error')],function() {
81- return new Bootstrap.Core.Tuple(Symbol.for('error'),Symbol.for('wrong_data'));
82- })))
62+ Bootstrap.Core.SpecialForms._with([new Bootstrap.Core.Tuple(Symbol.for('ok'), Bootstrap.Core.Patterns.variable()), function() {
63+ return Elixir.ElixirScript.Map.__load(Elixir).fetch(opts, Symbol.for('width'));
64+ }], [new Bootstrap.Core.Tuple(Symbol.for('ok'), Bootstrap.Core.Patterns.variable()), function(width) {
65+ return Elixir.ElixirScript.Map.__load(Elixir).fetch(opts, Symbol.for('height'));
66+ }], function(width, height) {
67+ return new Bootstrap.Core.Tuple(Symbol.for('ok'), width * height);
68+ }, Bootstrap.Core.Patterns.defmatch(Bootstrap.Core.Patterns.clause([Symbol.for('error')], function() {
69+ return new Bootstrap.Core.Tuple(Symbol.for('error'), Symbol.for('wrong_data'));
70+ })))
8371 """
8472
8573 assert_translation ( ex_ast , js_code )
0 commit comments