From 26785d40cac5f54d88fab10df17750e29576e7a0 Mon Sep 17 00:00:00 2001
From: Leonardo Balter <leonardo.balter@gmail.com>
Date: Fri, 5 Feb 2016 11:28:03 -0200
Subject: [PATCH] Add tests for zero conversion on Array#indexOf and
 Array#lastIndexOf

Fixes #435
---
 .../indexOf/fromindex-zero-conversion.js         | 16 ++++++++++++++++
 .../lastIndexOf/fromindex-zero-conversion.js     | 16 ++++++++++++++++
 2 files changed, 32 insertions(+)
 create mode 100644 test/built-ins/Array/prototype/indexOf/fromindex-zero-conversion.js
 create mode 100644 test/built-ins/Array/prototype/lastIndexOf/fromindex-zero-conversion.js

diff --git a/test/built-ins/Array/prototype/indexOf/fromindex-zero-conversion.js b/test/built-ins/Array/prototype/indexOf/fromindex-zero-conversion.js
new file mode 100644
index 0000000000..0336ee6acd
--- /dev/null
+++ b/test/built-ins/Array/prototype/indexOf/fromindex-zero-conversion.js
@@ -0,0 +1,16 @@
+// Copyright 2016 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)
diff --git a/test/built-ins/Array/prototype/lastIndexOf/fromindex-zero-conversion.js b/test/built-ins/Array/prototype/lastIndexOf/fromindex-zero-conversion.js
new file mode 100644
index 0000000000..4ad11f3cc5
--- /dev/null
+++ b/test/built-ins/Array/prototype/lastIndexOf/fromindex-zero-conversion.js
@@ -0,0 +1,16 @@
+// Copyright 2016 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);
-- 
GitLab