Repositorio del curso CCOM4030 el semestre B91 del proyecto Paz para la Mujer

1234567891011121314151617181920212223242526272829303132333435
  1. var falafel = require('falafel');
  2. var test = require('../');
  3. test('array', function (t) {
  4. t.plan(5);
  5. var src = '(' + function () {
  6. var xs = [ 1, 2, [ 3, 4 ] ];
  7. var ys = [ 5, 6 ];
  8. g([ xs, ys ]);
  9. } + ')()';
  10. var output = falafel(src, function (node) {
  11. if (node.type === 'ArrayExpression') {
  12. node.update('fn(' + node.source() + ')');
  13. }
  14. });
  15. var arrays = [
  16. [ 3, 4 ],
  17. [ 1, 2, [ 3, 4 ] ],
  18. [ 5, 6 ],
  19. [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ],
  20. ];
  21. Function(['fn','g'], output)(
  22. function (xs) {
  23. t.same(arrays.shift(), xs);
  24. return xs;
  25. },
  26. function (xs) {
  27. t.same(xs, [ [ 1, 2, [ 3, 4444 ] ], [ 5, 6 ] ]);
  28. }
  29. );
  30. });