-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rewrite library version tests from LiveScript to JavaScript
- Loading branch information
Showing
375 changed files
with
7,718 additions
and
5,449 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
global.includes = function (target, element) { | ||
for (var i = 0, length = target.length; i < length; ++i) if (target[i] === element) return true; | ||
return false; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
var test = QUnit.test; | ||
|
||
test('core.getIteratorMethod', function (assert) { | ||
var getIteratorMethod = core.getIteratorMethod; | ||
assert.isFunction(getIteratorMethod); | ||
var iterable = createIterable([]); | ||
var iterFn = getIteratorMethod(iterable); | ||
assert.isFunction(iterFn); | ||
assert.isIterator(iterFn.call(iterable)); | ||
assert.isFunction(getIteratorMethod([])); | ||
assert.isFunction(getIteratorMethod(function () { | ||
return arguments; | ||
}())); | ||
assert.isFunction(getIteratorMethod(Array.prototype)); | ||
assert.strictEqual(getIteratorMethod({}), undefined); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
var test = QUnit.test; | ||
|
||
test('core.getIterator', function (assert) { | ||
var getIterator = core.getIterator; | ||
assert.isFunction(getIterator); | ||
assert.isIterator(getIterator([])); | ||
assert.isIterator(getIterator(function () { | ||
return arguments; | ||
}())); | ||
assert.isIterator(getIterator(createIterable([]))); | ||
assert['throws'](function () { | ||
getIterator({}); | ||
}, TypeError); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var test = QUnit.test; | ||
|
||
test('core.isIterable', function (assert) { | ||
var isIterable = core.isIterable; | ||
assert.isFunction(isIterable); | ||
assert.ok(isIterable(createIterable([]))); | ||
assert.ok(isIterable([])); | ||
assert.ok(isIterable(function () { | ||
return arguments; | ||
}())); | ||
assert.ok(isIterable(Array.prototype)); | ||
assert.ok(!isIterable({})); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
var test = QUnit.test; | ||
|
||
test('Array#copyWithin', function (assert) { | ||
var copyWithin = core.Array.copyWithin; | ||
assert.isFunction(copyWithin); | ||
var array = [1]; | ||
assert.strictEqual(copyWithin(array, 0), array); | ||
assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 0, 3), [4, 5, 3, 4, 5]); | ||
assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 1, 3), [1, 4, 5, 4, 5]); | ||
assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 1, 2), [1, 3, 4, 5, 5]); | ||
assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 2, 2), [1, 2, 3, 4, 5]); | ||
assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 0, 3, 4), [4, 2, 3, 4, 5]); | ||
assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 1, 3, 4), [1, 4, 3, 4, 5]); | ||
assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 1, 2, 4), [1, 3, 4, 4, 5]); | ||
assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 0, -2), [4, 5, 3, 4, 5]); | ||
assert.deepEqual(copyWithin([1, 2, 3, 4, 5], 0, -2, -1), [4, 2, 3, 4, 5]); | ||
assert.deepEqual(copyWithin([1, 2, 3, 4, 5], -4, -3, -2), [1, 3, 3, 4, 5]); | ||
assert.deepEqual(copyWithin([1, 2, 3, 4, 5], -4, -3, -1), [1, 3, 4, 4, 5]); | ||
assert.deepEqual(copyWithin([1, 2, 3, 4, 5], -4, -3), [1, 3, 4, 5, 5]); | ||
if (STRICT) { | ||
assert['throws'](function () { | ||
copyWithin(null, 0); | ||
}, TypeError); | ||
assert['throws'](function () { | ||
copyWithin(undefined, 0); | ||
}, TypeError); | ||
} | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
var test = QUnit.test; | ||
|
||
test('Array#every', function (assert) { | ||
var every = core.Array.every; | ||
assert.isFunction(every); | ||
var array = [1]; | ||
var context = {}; | ||
every(array, function (value, key, that) { | ||
assert.same(arguments.length, 3, 'correct number of callback arguments'); | ||
assert.same(value, 1, 'correct value in callback'); | ||
assert.same(key, 0, 'correct index in callback'); | ||
assert.same(that, array, 'correct link to array in callback'); | ||
assert.same(this, context, 'correct callback context'); | ||
}, context); | ||
assert.ok(every([1, 2, 3], function (it) { | ||
return typeof it === 'number'; | ||
})); | ||
assert.ok(every([1, 2, 3], function (it) { | ||
return it < 4; | ||
})); | ||
assert.ok(!every([1, 2, 3], function (it) { | ||
return it < 3; | ||
})); | ||
assert.ok(!every([1, 2, 3], function (it) { | ||
return typeof it === 'string'; | ||
})); | ||
assert.ok(every([1, 2, 3], function () { | ||
return +this === 1; | ||
}, 1)); | ||
var rez = ''; | ||
every([1, 2, 3], function (value, key) { | ||
return rez += key; | ||
}); | ||
assert.ok(rez === '012'); | ||
var arr = [1, 2, 3]; | ||
assert.ok(every(arr, function (value, key, that) { | ||
return that === arr; | ||
})); | ||
if (STRICT) { | ||
assert['throws'](function () { | ||
every(null, function () { /* empty */ }); | ||
}, TypeError); | ||
assert['throws'](function () { | ||
every(undefined, function () { /* empty */ }); | ||
}, TypeError); | ||
} | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
var test = QUnit.test; | ||
|
||
test('Array#fill', function (assert) { | ||
var fill = core.Array.fill; | ||
assert.isFunction(fill); | ||
var array = fill(Array(5), 5); | ||
assert.strictEqual(array, array); | ||
assert.deepEqual(fill(Array(5), 5), [5, 5, 5, 5, 5]); | ||
assert.deepEqual(fill(Array(5), 5, 1), [undefined, 5, 5, 5, 5]); | ||
assert.deepEqual(fill(Array(5), 5, 1, 4), [undefined, 5, 5, 5, undefined]); | ||
assert.deepEqual(fill(Array(5), 5, 6, 1), [undefined, undefined, undefined, undefined, undefined]); | ||
assert.deepEqual(fill(Array(5), 5, -3, 4), [undefined, undefined, 5, 5, undefined]); | ||
if (STRICT) { | ||
assert['throws'](function () { | ||
fill(null, 0); | ||
}, TypeError); | ||
assert['throws'](function () { | ||
fill(undefined, 0); | ||
}, TypeError); | ||
} | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
var test = QUnit.test; | ||
|
||
test('Array#filter', function (assert) { | ||
var filter = core.Array.filter; | ||
assert.isFunction(filter); | ||
var array = [1]; | ||
var context = {}; | ||
filter(array, function (value, key, that) { | ||
assert.same(arguments.length, 3, 'correct number of callback arguments'); | ||
assert.same(value, 1, 'correct value in callback'); | ||
assert.same(key, 0, 'correct index in callback'); | ||
assert.same(that, array, 'correct link to array in callback'); | ||
assert.same(this, context, 'correct callback context'); | ||
}, context); | ||
assert.deepEqual([1, 2, 3, 4, 5], filter([1, 2, 3, 'q', {}, 4, true, 5], function (it) { | ||
return typeof it === 'number'; | ||
})); | ||
if (STRICT) { | ||
assert['throws'](function () { | ||
filter(null, function () { /* empty */ }); | ||
}, TypeError); | ||
assert['throws'](function () { | ||
filter(undefined, function () { /* empty */ }); | ||
}, TypeError); | ||
} | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
var test = QUnit.test; | ||
|
||
test('Array#findIndex', function (assert) { | ||
var findIndex = core.Array.findIndex; | ||
assert.isFunction(findIndex); | ||
var array = [1]; | ||
var context = {}; | ||
findIndex(array, function (value, key, that) { | ||
assert.strictEqual(this, context); | ||
assert.strictEqual(value, 1); | ||
assert.strictEqual(key, 0); | ||
assert.strictEqual(that, array); | ||
}, context); | ||
assert.strictEqual(findIndex([1, 3, NaN, 42, {}], function (it) { | ||
return it === 42; | ||
}), 3); | ||
if (STRICT) { | ||
assert['throws'](function () { | ||
findIndex(null, 0); | ||
}, TypeError); | ||
assert['throws'](function () { | ||
findIndex(undefined, 0); | ||
}, TypeError); | ||
} | ||
}); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.