shim.js 980 B

1234567891011121314151617181920212223242526272829
  1. "use strict";
  2. module.exports = function (t, a) {
  3. var args, x;
  4. a.h1("2 args");
  5. x = [1, 2, 3, 4, 5];
  6. t.call(x, 0, 3);
  7. a.deep(x, [4, 5, 3, 4, 5]);
  8. a.deep(t.call([1, 2, 3, 4, 5], 1, 3), [1, 4, 5, 4, 5]);
  9. a.deep(t.call([1, 2, 3, 4, 5], 1, 2), [1, 3, 4, 5, 5]);
  10. a.deep(t.call([1, 2, 3, 4, 5], 2, 2), [1, 2, 3, 4, 5]);
  11. a.h1("3 args");
  12. a.deep(t.call([1, 2, 3, 4, 5], 0, 3, 4), [4, 2, 3, 4, 5]);
  13. a.deep(t.call([1, 2, 3, 4, 5], 1, 3, 4), [1, 4, 3, 4, 5]);
  14. a.deep(t.call([1, 2, 3, 4, 5], 1, 2, 4), [1, 3, 4, 4, 5]);
  15. a.h1("Negative args");
  16. a.deep(t.call([1, 2, 3, 4, 5], 0, -2), [4, 5, 3, 4, 5]);
  17. a.deep(t.call([1, 2, 3, 4, 5], 0, -2, -1), [4, 2, 3, 4, 5]);
  18. a.deep(t.call([1, 2, 3, 4, 5], -4, -3, -2), [1, 3, 3, 4, 5]);
  19. a.deep(t.call([1, 2, 3, 4, 5], -4, -3, -1), [1, 3, 4, 4, 5]);
  20. a.deep(t.call([1, 2, 3, 4, 5], -4, -3), [1, 3, 4, 5, 5]);
  21. a.h1("Array-likes");
  22. args = { 0: 1, 1: 2, 2: 3, length: 3 };
  23. a.deep(t.call(args, -2, 0), { 0: 1, 1: 1, 2: 2, length: 3 });
  24. };