all ✓ tests passed successfully only two problems detected for now.
# 1. unexpected comma:
foo(() -> bar(if true then 1 else 2, 3)).toString()
^
// 2. ; doesn't end expression but that's actually normal ?
foo(() -> x = () -> 1; y = () -> 2; [x.call, y.call])
// transpiled:
{"0":"function foo() { return x = function() { 1; return y = function() { 2; return [x.call, y.call]; }; };}"}
// expected:
{"0":"function foo() { x = function() { return 1; }; y = function() { return 2; }; return [x.call, y.call];}"}
node bin/coffee test_lit_fun_as_arg.coffee
✓ function foo() { return bar(1, 2);}
✓ function foo() { return { 1: 1 };}
✓ function foo() { return { 1: 1, 2: 2, 3: 3 };}
✓ function foo() { return implicitCall(1, 2);}
✓ function foo() { return 1;}
✓ function foo() { return { 1: 1, 2: 2 };}
✓ function foo() { implicitCall(1, 2); return { 1: 1, 2: 2 };}
✓ function foo() { return 1;}
✓ function foo() { return bar(1, 2);}
✓ function foo() { return implicitCall(1, 2);}
✓ function foo() { return { a: 1, b: 2 };}
✓ function foo() { return bar(function() { return 1; }, 2);}
✓ function foo() { return bar(function() { return baz(1, 2); });}
✓ function foo() { return bar(function() { return { 1: 1, 2: 2 }; }, function() { return { 3: 3, 4: 4 }; });}
✓ function foo() { return bar(function() { return implicitCall(1, 2); });}
✓ function foo() { return bar(function() { return baz(function() { return 1; }, 2); });}
✓ function foo() { return bar(function() { return baz(function() { return bax(function() { return 1; }, 2); }); });}
✓ function foo() { return bar(function() { return baz(function() { return { a: 1, b: function() { return 2; } }; }); });}
✓ function foo() { x = 1; return x + 2;}
✓ function foo() { x = bar(1, 2); return x * 3;}
✓ function foo() { y = 1; return x = function() { return 1; };}
✓ function foo() { if (true) { return 1; } else { return 2; }}
✓ function foo() { if (true) { return bar; }}
✓ function foo() { return [1, 2, 3][0];}
✓ function foo() { return "string".upcase.reverse;}
✓ function foo() { return bar(1, 2).baz.qux;}
✓ function foo() { return bar(1, function() { return 2; });}
✓ function foo() { return bar(1, function() { return 2; });}
✓ function foo() { return bar(function() { return baz(1, 2); });}
✓ function foo() { return bar(function() { return baz(1); }, 2);}
✓ function foo() { bar(1); return baz(2);}
✓ function foo() { x = 1; y = 2; return x + y;}
✓ function foo() { bar(1); return function() { return baz(2); };}
✓ function foo() { return bar(1, 2);}
✓ function foo() { return bar(1, 2);}
✓ function foo() { return bar(1, 2);}
✓ function foo() { return bar(1, 2);}
✓ function foo() { return function() { return function() { return 1; }; };}
✓ function foo() { return bar(1, 2).baz(function() { return 3; }).qux({ a: function() { return 4; } });}
✓ function foo() { return bar(function() { return baz(function() { return { a: 1, b: function() { return { c: 2 }; } }; }); });}
✓ function foo() { return `Result: ${bar(1, 2)}`;}
✓ function foo() { return `Lambda result: ${function() { return 1; }}`;}
✓ function foo() { return `Result: ${bar(function() { return baz(1); })}`;}
✓ function foo() { return `${bar(1)} + ${baz(2)}`;}
✓ function foo() { return 1 + 2 * 3;}
✓ function foo() { return (1 + 2) * 3;}
✓ function foo() { return bar(1) + baz(2);}
✓ function foo() { return bar(1 + 2) * baz(3 - 4);}
✓ function foo() { return bar({ a: 1, b: 2 });}
✓ function foo() { return bar(1, 2, { a: 3, b: 4 });}
✓ function foo() { return (function() { return 1; }).call + 2;}
✓ function foo() { return (function() { return (function() { return 1; }).call; }).call;}
✓ function foo() { return bar(function() { return 1; }).call(2);}
✓ function foo() { return (function() { return bar(1); }).call.baz;}
FAILURES:
Failed at ternary in lit. fun.'s subexpr
test_lit_fun_as_arg.coffee:197:41: error: unexpected ,
cs = foo(() -> bar(if true then 1 else 2, 3)).toString()
^
Failed at complex multi-statement:
# CS:
{"0":"function foo() { return x = function() { 1; return y = function() { 2; return [x.call, y.call]; }; };}"}
# JS:
{"0":"function foo() { x = function() { return 1; }; y = function() { return 2; }; return [x.call, y.call];}"}
==== RESULTS ====
PASS: 54
FAIL: 2