]> git.r.bdr.sh - rbdr/dotfiles/blob
93c85ea3114c2448b3ecc704b644e61df190feef
[rbdr/dotfiles] /
1 'use strict';
2
3 module.exports = function (t, a) {
4 var args, x;
5
6 a.h1("2 args");
7 x = [1, 2, 3, 4, 5];
8 t.call(x, 0, 3);
9 a.deep(x, [4, 5, 3, 4, 5]);
10 a.deep(t.call([1, 2, 3, 4, 5], 1, 3), [1, 4, 5, 4, 5]);
11 a.deep(t.call([1, 2, 3, 4, 5], 1, 2), [1, 3, 4, 5, 5]);
12 a.deep(t.call([1, 2, 3, 4, 5], 2, 2), [1, 2, 3, 4, 5]);
13
14 a.h1("3 args");
15 a.deep(t.call([1, 2, 3, 4, 5], 0, 3, 4), [4, 2, 3, 4, 5]);
16 a.deep(t.call([1, 2, 3, 4, 5], 1, 3, 4), [1, 4, 3, 4, 5]);
17 a.deep(t.call([1, 2, 3, 4, 5], 1, 2, 4), [1, 3, 4, 4, 5]);
18
19 a.h1("Negative args");
20 a.deep(t.call([1, 2, 3, 4, 5], 0, -2), [4, 5, 3, 4, 5]);
21 a.deep(t.call([1, 2, 3, 4, 5], 0, -2, -1), [4, 2, 3, 4, 5]);
22 a.deep(t.call([1, 2, 3, 4, 5], -4, -3, -2), [1, 3, 3, 4, 5]);
23 a.deep(t.call([1, 2, 3, 4, 5], -4, -3, -1), [1, 3, 4, 4, 5]);
24 a.deep(t.call([1, 2, 3, 4, 5], -4, -3), [1, 3, 4, 5, 5]);
25
26 a.h1("Array-likes");
27 args = { 0: 1, 1: 2, 2: 3, length: 3 };
28 a.deep(t.call(args, -2, 0), { '0': 1, '1': 1, '2': 2, length: 3 });
29 };