Skip to content

Commit

Permalink
Array.from: add tests asserting that it works with primitives.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Aug 6, 2014
1 parent 4db0020 commit f81b324
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ var runArrayTests = function() {
expect(Array.propertyIsEnumerable('from')).to.equal(false);
});

it('works with primitives', function () {
expect(Array.from(false)).to.eql([]);
expect(Array.from(true)).to.eql([]);
expect(Array.from(-Infinity)).to.eql([]);
expect(Array.from(-0)).to.eql([]);
expect(Array.from(0)).to.eql([]);
expect(Array.from(1)).to.eql([]);
expect(Array.from(Infinity)).to.eql([]);
});

it('should create correct array from iterable', function() {
(function() {
expect(Array.from(arguments)).to.eql([0, 1, 2]);
Expand Down

0 comments on commit f81b324

Please sign in to comment.