Skip to content

Commit

Permalink
Add tests for zero conversion on Array#indexOf and Array#lastIndexOf
Browse files Browse the repository at this point in the history
Fixes tc39#435
  • Loading branch information
leobalter committed Feb 5, 2016
1 parent fbad349 commit d4b6d9a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2015 The V8 project authors. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
id: sec-array.prototype.indexof
description: >
Return +0 when fromIndex is -0 and return index refers to the first position
info: >
22.1.3.12 Array.prototype.indexOf ( searchElement [ , fromIndex ] )
...
6. If n ≥ 0, then
a. If n is -0, let k be +0; else let k be n.
...
---*/

assert.sameValue(1 / [true].indexOf(true, -0), +Infinity)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2015 The V8 project authors. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
id: sec-array.prototype.lastindexof
description: >
Return +0 when fromIndex is -0 and return index refers to the first position
info: >
22.1.3.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
...
5. If n ≥ 0, then
a. If n is -0, let k be +0; else let k be min(n, len - 1).
...
---*/

assert.sameValue(1 / [true].lastIndexOf(true, -0), +Infinity);

0 comments on commit d4b6d9a

Please sign in to comment.