2d24569d94d86d93818c7031d9e0b9d77f93b3db
[platform/framework/web/crosswalk-tizen.git] /
1 'use strict';
2
3 module.exports = {
4         __generic: function (t, a) {
5                 var count = 0, first, last, x, icount = this.length;
6                 t.call(this, function (item, index, col) {
7                         ++count;
8                         if (!first) {
9                                 first = item;
10                         }
11                         last = item;
12                         x = col;
13                         a(index, --icount, "Index");
14                 });
15                 a(count, this.length, "Iterated");
16                 a(first, this[this.length - 1], "First is last");
17                 a(last, this[0], "Last is first");
18                 a.deep(x, Object(this), "Collection as third argument"); //jslint: skip
19         },
20         "": function (t, a) {
21                 var x = {}, y, count;
22                 t.call([1], function () { y = this; }, x);
23                 a(y, x, "Scope");
24                 y = 0;
25                 t.call([3, 4, 4], function (a, i) { y += i; });
26                 a(y, 3, "Indexes");
27
28                 x = [1, 3];
29                 x[5] = 'x';
30                 y = 0;
31                 count = 0;
32                 t.call(x, function (a, i) { ++count; y += i; });
33                 a(y, 6, "Misssing Indexes");
34                 a(count, 3, "Misssing Indexes, count");
35         }
36 };