502e7b767f61b2bc22ff7702cab16d39ab306e00
[platform/framework/web/crosswalk-tizen.git] /
1 'use strict';
2
3 var ArrayIterator = require('../array')
4
5   , slice = Array.prototype.slice;
6
7 module.exports = function (t, a) {
8         var i = 0, x = ['raz', 'dwa', 'trzy'], y = {}, called = 0;
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(x = 'foo', function () {
15                 a.deep(slice.call(arguments, 0, 1), [x[i]], "String " + i + "#");
16                 a(this, y, "Regular String: context:  " + (i++) + "#");
17         }, y);
18         i = 0;
19         x = ['r', '💩', 'z'];
20         t('r💩z', function () {
21                 a.deep(slice.call(arguments, 0, 1), [x[i]], "String " + i + "#");
22                 a(this, y, "Unicode String: context:  " + (i++) + "#");
23         }, y);
24         i = 0;
25         t(new ArrayIterator(x), function () {
26                 a.deep(slice.call(arguments, 0, 1), [x[i]], "Iterator " + i + "#");
27                 a(this, y, "Iterator: context:  " + (i++) + "#");
28         }, y);
29
30         t(x = ['raz', 'dwa', 'trzy'], function (value, doBreak) {
31                 ++called;
32                 return doBreak();
33         });
34         a(called, 1, "Break");
35 };