Repositorio del curso CCOM4030 el semestre B91 del proyecto kilometro0

nested.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. var falafel = require('falafel');
  2. var test = require('../');
  3. test('nested array test', 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. t.test('inside test', function (q) {
  16. q.plan(2);
  17. q.ok(true, 'inside ok');
  18. setTimeout(function () {
  19. q.ok(true, 'inside delayed');
  20. }, 3000);
  21. });
  22. var arrays = [
  23. [ 3, 4 ],
  24. [ 1, 2, [ 3, 4 ] ],
  25. [ 5, 6 ],
  26. [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ],
  27. ];
  28. Function(['fn','g'], output)(
  29. function (xs) {
  30. t.same(arrays.shift(), xs);
  31. return xs;
  32. },
  33. function (xs) {
  34. t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]);
  35. }
  36. );
  37. });
  38. test('another', function (t) {
  39. t.plan(1);
  40. setTimeout(function () {
  41. t.ok(true);
  42. }, 100);
  43. });