Skip to content

Commit

Permalink
Array.from: ensure a primitive thisArg works
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Aug 6, 2014
1 parent 9bb0be1 commit 7bb243b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ var runArrayTests = function() {
expect(this).to.equal(context);
}, context);
});

it('accepts a primitive thisArg', function () {
Array.from([1, 2, 3], function (value, index) {
expect(this.valueOf()).to.equal(42);
expect(Object.prototype.toString.call(this)).to.equal('[object Number]');
}, 42);
});
});

it('throws when provided a nonfunction second arg', function() {
Expand Down

0 comments on commit 7bb243b

Please sign in to comment.