]> git.r.bdr.sh - rbdr/dotfiles/blob
0fed8ad898990e1ea74bafe492a55b74d4c70ce9
[rbdr/dotfiles] /
1 'use strict';
2
3 var ArrayIterator = require('es6-iterator/array')
4
5 , slice = Array.prototype.slice;
6
7 module.exports = function (t, a) {
8 var i = 0, x = ['raz', 'dwa', 'trzy'], y = {};
9 t(x, function () {
10 a.deep(slice.call(arguments, 0, 1), [x[i]], "Array " + i + "#");
11 a(this, y, "Array: context: " + (i++) + "#");
12 }, y);
13 i = 0;
14 t((function () { return arguments; }('raz', 'dwa', 'trzy')), function () {
15 a.deep(slice.call(arguments, 0, 1), [x[i]], "Arguments" + i + "#");
16 a(this, y, "Arguments: context: " + (i++) + "#");
17 }, y);
18 i = 0;
19 t({ 0: 'raz', 1: 'dwa', 2: 'trzy', length: 3 }, function () {
20 a.deep(slice.call(arguments, 0, 1), [x[i]], "Array-like" + i + "#");
21 a(this, y, "Array-like: context: " + (i++) + "#");
22 }, y);
23 i = 0;
24 t(x = 'foo', function () {
25 a.deep(slice.call(arguments, 0, 1), [x[i]], "String " + i + "#");
26 a(this, y, "Regular String: context: " + (i++) + "#");
27 }, y);
28 i = 0;
29 x = ['r', '💩', 'z'];
30 t('r💩z', function () {
31 a.deep(slice.call(arguments, 0, 1), [x[i]], "String " + i + "#");
32 a(this, y, "Unicode String: context: " + (i++) + "#");
33 }, y);
34 i = 0;
35 t(new ArrayIterator(x), function () {
36 a.deep(slice.call(arguments, 0, 1), [x[i]], "Iterator " + i + "#");
37 a(this, y, "Iterator: context: " + (i++) + "#");
38 }, y);
39
40 };