From 138f8b1fdb8fd944dd8a371e94d58e2d33867702 Mon Sep 17 00:00:00 2001
From: Leonardo Balter <leonardo.balter@gmail.com>
Date: Mon, 16 May 2016 12:21:56 -0400
Subject: [PATCH] Add tests for DataView.prototype.setInt8

---
 .../byteoffset-is-different-integer-throws.js | 61 ++++++++++++++++++
 .../setInt8/byteoffset-is-negative-throws.js  | 36 +++++++++++
 ...etached-buffer-after-integer-byteoffset.js | 37 +++++++++++
 .../detached-buffer-after-number-value.js     | 38 +++++++++++
 ...hed-buffer-before-outofrange-byteoffset.js | 39 ++++++++++++
 .../prototype/setInt8/detached-buffer.js      | 30 +++++++++
 .../index-check-before-value-conversion.js    |  7 ++-
 .../setInt8/index-is-out-of-range.js          | 63 +++++++++++++++++++
 .../prototype/setInt8/index-to-integer.js     |  2 +-
 .../prototype/setInt8/no-value-arg.js         | 38 +++++++++++
 .../range-check-after-value-conversion.js     | 14 ++---
 ...-abrupt-from-tonumber-byteoffset-symbol.js | 30 +++++++++
 .../return-abrupt-from-tonumber-byteoffset.js | 43 +++++++++++++
 ...eturn-abrupt-from-tonumber-value-symbol.js | 30 +++++++++
 .../return-abrupt-from-tonumber-value.js      | 43 +++++++++++++
 .../setInt8/set-values-return-undefined.js    | 52 +++++++++++++++
 .../setInt8/this-has-no-dataview-internal.js  | 42 +++++++++++++
 .../prototype/setInt8/this-is-not-object.js   | 50 +++++++++++++++
 18 files changed, 643 insertions(+), 12 deletions(-)
 create mode 100644 test/built-ins/DataView/prototype/setInt8/byteoffset-is-different-integer-throws.js
 create mode 100644 test/built-ins/DataView/prototype/setInt8/byteoffset-is-negative-throws.js
 create mode 100644 test/built-ins/DataView/prototype/setInt8/detached-buffer-after-integer-byteoffset.js
 create mode 100644 test/built-ins/DataView/prototype/setInt8/detached-buffer-after-number-value.js
 create mode 100644 test/built-ins/DataView/prototype/setInt8/detached-buffer-before-outofrange-byteoffset.js
 create mode 100644 test/built-ins/DataView/prototype/setInt8/detached-buffer.js
 create mode 100644 test/built-ins/DataView/prototype/setInt8/index-is-out-of-range.js
 create mode 100644 test/built-ins/DataView/prototype/setInt8/no-value-arg.js
 create mode 100644 test/built-ins/DataView/prototype/setInt8/return-abrupt-from-tonumber-byteoffset-symbol.js
 create mode 100644 test/built-ins/DataView/prototype/setInt8/return-abrupt-from-tonumber-byteoffset.js
 create mode 100644 test/built-ins/DataView/prototype/setInt8/return-abrupt-from-tonumber-value-symbol.js
 create mode 100644 test/built-ins/DataView/prototype/setInt8/return-abrupt-from-tonumber-value.js
 create mode 100644 test/built-ins/DataView/prototype/setInt8/set-values-return-undefined.js
 create mode 100644 test/built-ins/DataView/prototype/setInt8/this-has-no-dataview-internal.js
 create mode 100644 test/built-ins/DataView/prototype/setInt8/this-is-not-object.js

diff --git a/test/built-ins/DataView/prototype/setInt8/byteoffset-is-different-integer-throws.js b/test/built-ins/DataView/prototype/setInt8/byteoffset-is-different-integer-throws.js
new file mode 100644
index 0000000000..507836935a
--- /dev/null
+++ b/test/built-ins/DataView/prototype/setInt8/byteoffset-is-different-integer-throws.js
@@ -0,0 +1,61 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-dataview.prototype.setint8
+es6id: 24.2.4.15
+description: >
+  Throws a RangeError if numberIndex ≠ getIndex
+info: |
+  24.2.4.15 DataView.prototype.setInt8 ( byteOffset, value )
+
+  1. Let v be the this value.
+  2. Return ? SetViewValue(v, byteOffset, true, "Int8", value).
+
+  24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
+
+  ...
+  4. Let numberIndex be ? ToNumber(requestIndex).
+  5. Let getIndex be ToInteger(numberIndex).
+  6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
+  ...
+features: [DataView.prototype.getInt8]
+---*/
+
+var buffer = new ArrayBuffer(12);
+var sample = new DataView(buffer, 0);
+
+assert.throws(RangeError, function() {
+  sample.setInt8();
+}, "no args");
+assert.sameValue(sample.getInt8(0), 0, "no args - no value was set");
+
+assert.throws(RangeError, function() {
+  sample.setInt8(undefined, 39);
+}, "undefined");
+assert.sameValue(sample.getInt8(0), 0, "undefined - no value was set");
+
+assert.throws(RangeError, function() {
+  sample.setInt8(1.1, 39);
+}, "floating number");
+assert.sameValue(sample.getInt8(0), 0, "floating number - no value was set");
+
+assert.throws(RangeError, function() {
+  sample.setInt8(0.1, 39);
+}, "0.1");
+assert.sameValue(sample.getInt8(0), 0, "0.1 - no value was set");
+
+assert.throws(RangeError, function() {
+  sample.setInt8(NaN, 39);
+}, "NaN");
+assert.sameValue(sample.getInt8(0), 0, "NaN - no value was set");
+
+assert.throws(RangeError, function() {
+  sample.setInt8(-0.1, 39);
+}, "-0.1");
+assert.sameValue(sample.getInt8(0), 0, "-0.1 - no value was set");
+
+assert.throws(RangeError, function() {
+  sample.setInt8(-1.1, 39);
+}, "-1.1");
+assert.sameValue(sample.getInt8(0), 0, "-1.1 - no value was set");
diff --git a/test/built-ins/DataView/prototype/setInt8/byteoffset-is-negative-throws.js b/test/built-ins/DataView/prototype/setInt8/byteoffset-is-negative-throws.js
new file mode 100644
index 0000000000..09b103b754
--- /dev/null
+++ b/test/built-ins/DataView/prototype/setInt8/byteoffset-is-negative-throws.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-dataview.prototype.setint8
+es6id: 24.2.4.15
+description: >
+  Throws a RangeError if getIndex < 0
+info: |
+  24.2.4.15 DataView.prototype.setInt8 ( byteOffset, value )
+
+  1. Let v be the this value.
+  2. Return ? SetViewValue(v, byteOffset, true, "Int8", value).
+
+  24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
+
+  ...
+  4. Let numberIndex be ? ToNumber(requestIndex).
+  5. Let getIndex be ToInteger(numberIndex).
+  6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
+  ...
+features: [DataView.prototype.getInt8]
+---*/
+
+var buffer = new ArrayBuffer(12);
+var sample = new DataView(buffer, 0);
+
+assert.throws(RangeError, function() {
+  sample.setInt8(-1, 39);
+}, "-1");
+assert.sameValue(sample.getInt8(0), 0, "-1 - no value was set");
+
+assert.throws(RangeError, function() {
+  sample.setInt8(-Infinity, 39);
+}, "-Infinity");
+assert.sameValue(sample.getInt8(0), 0, "-Infinity - no value was set");
diff --git a/test/built-ins/DataView/prototype/setInt8/detached-buffer-after-integer-byteoffset.js b/test/built-ins/DataView/prototype/setInt8/detached-buffer-after-integer-byteoffset.js
new file mode 100644
index 0000000000..beab4af062
--- /dev/null
+++ b/test/built-ins/DataView/prototype/setInt8/detached-buffer-after-integer-byteoffset.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-dataview.prototype.setint8
+es6id: 24.2.4.15
+description: >
+  Detached buffer is checked after checking If numberIndex ≠ getIndex or
+  getIndex < 0
+info: |
+  24.2.4.15 DataView.prototype.setInt8 ( byteOffset, value )
+
+  1. Let v be the this value.
+  2. Return ? SetViewValue(v, byteOffset, true, "Int8", value).
+
+  24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
+
+  ...
+  6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
+  ...
+  9. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
+  10. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+  ...
+includes: [detachArrayBuffer.js]
+---*/
+
+var buffer = new ArrayBuffer(12);
+var sample = new DataView(buffer, 0);
+
+$DETACHBUFFER(buffer);
+assert.throws(RangeError, function() {
+  sample.setInt8(1.1, 0);
+});
+
+assert.throws(RangeError, function() {
+  sample.setInt8(-1, 0);
+});
diff --git a/test/built-ins/DataView/prototype/setInt8/detached-buffer-after-number-value.js b/test/built-ins/DataView/prototype/setInt8/detached-buffer-after-number-value.js
new file mode 100644
index 0000000000..bc710830ed
--- /dev/null
+++ b/test/built-ins/DataView/prototype/setInt8/detached-buffer-after-number-value.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-dataview.prototype.setint8
+es6id: 24.2.4.15
+description: >
+  Detached buffer is checked after ToNumber(value)
+info: |
+  24.2.4.15 DataView.prototype.setInt8 ( byteOffset, value )
+
+  1. Let v be the this value.
+  2. Return ? SetViewValue(v, byteOffset, true, "Int8", value).
+
+  24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
+
+  ...
+  7. Let numberValue be ? ToNumber(value).
+  ...
+  9. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
+  10. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+  ...
+includes: [detachArrayBuffer.js]
+---*/
+
+var buffer = new ArrayBuffer(8);
+var sample = new DataView(buffer, 0);
+
+var v = {
+  valueOf: function() {
+    throw new Test262Error();
+  }
+};
+
+$DETACHBUFFER(buffer);
+assert.throws(Test262Error, function() {
+  sample.setInt8(0, v);
+});
diff --git a/test/built-ins/DataView/prototype/setInt8/detached-buffer-before-outofrange-byteoffset.js b/test/built-ins/DataView/prototype/setInt8/detached-buffer-before-outofrange-byteoffset.js
new file mode 100644
index 0000000000..a1ff142587
--- /dev/null
+++ b/test/built-ins/DataView/prototype/setInt8/detached-buffer-before-outofrange-byteoffset.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-dataview.prototype.setint8
+es6id: 24.2.4.15
+description: >
+  Detached buffer is checked before out of range byteOffset's value
+info: |
+  24.2.4.15 DataView.prototype.setInt8 ( byteOffset, value )
+
+  1. Let v be the this value.
+  2. Return ? SetViewValue(v, byteOffset, true, "Int8", value).
+
+  24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
+
+  ...
+  9. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
+  10. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+  ...
+  14. If getIndex + elementSize > viewSize, throw a RangeError exception.
+  ...
+includes: [detachArrayBuffer.js]
+---*/
+
+var sample;
+var buffer = new ArrayBuffer(12);
+
+sample = new DataView(buffer, 0);
+
+$DETACHBUFFER(buffer);
+
+assert.throws(TypeError, function() {
+  sample.setInt8(Infinity, 0);
+}, "Infinity");
+
+assert.throws(TypeError, function() {
+  sample.setInt8(13, 0);
+}, "13");
diff --git a/test/built-ins/DataView/prototype/setInt8/detached-buffer.js b/test/built-ins/DataView/prototype/setInt8/detached-buffer.js
new file mode 100644
index 0000000000..8742259d04
--- /dev/null
+++ b/test/built-ins/DataView/prototype/setInt8/detached-buffer.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-dataview.prototype.setint8
+es6id: 24.2.4.15
+description: >
+  Throws a TypeError if buffer is detached
+info: |
+  24.2.4.15 DataView.prototype.setInt8 ( byteOffset, value )
+
+  1. Let v be the this value.
+  2. Return ? SetViewValue(v, byteOffset, true, "Int8", value).
+
+  24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
+
+  ...
+  9. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
+  10. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+  ...
+includes: [detachArrayBuffer.js]
+---*/
+
+var buffer = new ArrayBuffer(1);
+var sample = new DataView(buffer, 0);
+
+$DETACHBUFFER(buffer);
+assert.throws(TypeError, function() {
+  sample.setInt8(0, 0);
+});
diff --git a/test/built-ins/DataView/prototype/setInt8/index-check-before-value-conversion.js b/test/built-ins/DataView/prototype/setInt8/index-check-before-value-conversion.js
index 3dc06e669f..d297712e0c 100755
--- a/test/built-ins/DataView/prototype/setInt8/index-check-before-value-conversion.js
+++ b/test/built-ins/DataView/prototype/setInt8/index-check-before-value-conversion.js
@@ -4,7 +4,8 @@
 /*---
 esid: sec-dataview.prototype.setint8
 description: >
-  Throws a RangeError if the index is negative or non-integral number.
+  RangeError exception for negative or non-integral index is thrown before
+  the value conversion.
 info: >
   ...
   3. Return SetViewValue(v, byteOffset, littleEndian, "Int8", value).
@@ -18,11 +19,11 @@ info: >
     ...
 ---*/
 
-var dataView = new DataView(new ArrayBuffer(8));
+var dataView = new DataView(new ArrayBuffer(8), 0);
 
 var poisoned = {
   valueOf: function() {
-    $ERROR("valueOf called");
+    throw new Test262Error("valueOf called");
   }
 };
 
diff --git a/test/built-ins/DataView/prototype/setInt8/index-is-out-of-range.js b/test/built-ins/DataView/prototype/setInt8/index-is-out-of-range.js
new file mode 100644
index 0000000000..d61669fb33
--- /dev/null
+++ b/test/built-ins/DataView/prototype/setInt8/index-is-out-of-range.js
@@ -0,0 +1,63 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-dataview.prototype.setint8
+es6id: 24.2.4.15
+description: >
+  Throws a RangeError if getIndex + elementSize > viewSize
+info: |
+  24.2.4.15 DataView.prototype.setInt8 ( byteOffset, value )
+
+  1. Let v be the this value.
+  2. Return ? SetViewValue(v, byteOffset, true, "Int8", value).
+
+  24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
+
+  ...
+  11. Let viewOffset be the value of view's [[ByteOffset]] internal slot.
+  12. Let viewSize be the value of view's [[ByteLength]] internal slot.
+  13. Let elementSize be the Number value of the Element Size value specified in
+  Table 50 for Element Type type.
+  14. If getIndex + elementSize > viewSize, throw a RangeError exception.
+  ...
+features: [DataView.prototype.getInt8]
+---*/
+
+var sample;
+var buffer = new ArrayBuffer(4);
+
+sample = new DataView(buffer, 0);
+
+assert.throws(RangeError, function() {
+  sample.setInt8(Infinity, 39);
+}, "getIndex == Infinity");
+
+assert.throws(RangeError, function() {
+  sample.setInt8(5, 39);
+}, "5 + 1 > 4");
+
+assert.throws(RangeError, function() {
+  sample.setInt8(4, 39);
+}, "4 + 1 > 4");
+
+sample = new DataView(buffer, 3);
+assert.throws(RangeError, function() {
+  sample.setInt8(1, 39);
+}, "1 + 1 > 1 (offset)");
+
+sample = new DataView(buffer, 0, 1);
+assert.throws(RangeError, function() {
+  sample.setInt8(1, 39);
+}, "1 + 1 > 1 (length)");
+
+sample = new DataView(buffer, 2, 1);
+assert.throws(RangeError, function() {
+  sample.setInt8(1, 39);
+}, "1 + 1 > 1 (offset+length)");
+
+sample = new DataView(buffer, 0);
+assert.sameValue(sample.getInt8(0), 0, "[0] no value was set");
+assert.sameValue(sample.getInt8(1), 0, "[1] no value was set");
+assert.sameValue(sample.getInt8(2), 0, "[2] no value was set");
+assert.sameValue(sample.getInt8(3), 0, "[3] no value was set");
diff --git a/test/built-ins/DataView/prototype/setInt8/index-to-integer.js b/test/built-ins/DataView/prototype/setInt8/index-to-integer.js
index 1c49cba579..409f722bbe 100755
--- a/test/built-ins/DataView/prototype/setInt8/index-to-integer.js
+++ b/test/built-ins/DataView/prototype/setInt8/index-to-integer.js
@@ -17,7 +17,7 @@ info: >
     ...
 ---*/
 
-var dataView = new DataView(new ArrayBuffer(8));
+var dataView = new DataView(new ArrayBuffer(8), 0);
 
 dataView.setInt8(+0, 1);
 assert.sameValue(dataView.getInt8(0), 1, "setInt8(+0, 1)");
diff --git a/test/built-ins/DataView/prototype/setInt8/no-value-arg.js b/test/built-ins/DataView/prototype/setInt8/no-value-arg.js
new file mode 100644
index 0000000000..833d6ab35d
--- /dev/null
+++ b/test/built-ins/DataView/prototype/setInt8/no-value-arg.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-dataview.prototype.setint8
+es6id: 24.2.4.15
+description: >
+  Set value as undefined (cast to 0) when value argument is not present
+info: |
+  24.2.4.15 DataView.prototype.setInt8 ( byteOffset, value )
+
+  1. Let v be the this value.
+  2. Return ? SetViewValue(v, byteOffset, true, "Int8", value).
+
+  24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
+
+  ...
+  15. Let bufferIndex be getIndex + viewOffset.
+  16. Return SetValueInBuffer(buffer, bufferIndex, type, numberValue, isLittleEndian).
+
+  24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , isLittleEndian ] )
+
+  ...
+  11. Store the individual bytes of rawBytes into block, in order, starting at
+  block[byteIndex].
+  12. Return NormalCompletion(undefined).
+features: [DataView.prototype.getInt8]
+---*/
+
+var buffer = new ArrayBuffer(8);
+var sample = new DataView(buffer, 0);
+
+sample.setInt8(0, 42);
+
+var result = sample.setInt8(0);
+
+assert.sameValue(sample.getInt8(0), 0);
+assert.sameValue(result, undefined);
diff --git a/test/built-ins/DataView/prototype/setInt8/range-check-after-value-conversion.js b/test/built-ins/DataView/prototype/setInt8/range-check-after-value-conversion.js
index 15a2c27e6a..d723d74341 100755
--- a/test/built-ins/DataView/prototype/setInt8/range-check-after-value-conversion.js
+++ b/test/built-ins/DataView/prototype/setInt8/range-check-after-value-conversion.js
@@ -22,28 +22,26 @@ info: >
     ...
 ---*/
 
-var dataView = new DataView(new ArrayBuffer(8));
-
-function DummyError() { }
+var dataView = new DataView(new ArrayBuffer(8), 0);
 
 var poisoned = {
   valueOf: function() {
-    throw new DummyError();
+    throw new Test262Error();
   }
 };
 
-assert.throws(DummyError, function() {
+assert.throws(Test262Error, function() {
   dataView.setInt8(Infinity, poisoned);
 }, "setInt8(Infinity, poisoned)");
 
-assert.throws(DummyError, function() {
+assert.throws(Test262Error, function() {
   dataView.setInt8(100, poisoned);
 }, "setInt8(100, poisoned)");
 
-assert.throws(DummyError, function() {
+assert.throws(Test262Error, function() {
   dataView.setInt8('Infinity', poisoned);
 }, "setInt8('Infinity', poisoned)");
 
-assert.throws(DummyError, function() {
+assert.throws(Test262Error, function() {
   dataView.setInt8('100', poisoned);
 }, "setInt8('100', poisoned)");
diff --git a/test/built-ins/DataView/prototype/setInt8/return-abrupt-from-tonumber-byteoffset-symbol.js b/test/built-ins/DataView/prototype/setInt8/return-abrupt-from-tonumber-byteoffset-symbol.js
new file mode 100644
index 0000000000..66013d0659
--- /dev/null
+++ b/test/built-ins/DataView/prototype/setInt8/return-abrupt-from-tonumber-byteoffset-symbol.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-dataview.prototype.setint8
+es6id: 24.2.4.15
+description: >
+  Return abrupt from ToNumber(symbol byteOffset)
+info: |
+  24.2.4.15 DataView.prototype.setInt8 ( byteOffset, value )
+
+  1. Let v be the this value.
+  2. Return ? SetViewValue(v, byteOffset, true, "Int8", value).
+
+  24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
+
+  ...
+  4. Let numberIndex be ? ToNumber(requestIndex).
+  ...
+features: [Symbol]
+---*/
+
+var buffer = new ArrayBuffer(1);
+var sample = new DataView(buffer, 0);
+
+var s = Symbol("1");
+
+assert.throws(TypeError, function() {
+  sample.setInt8(s, 1);
+});
diff --git a/test/built-ins/DataView/prototype/setInt8/return-abrupt-from-tonumber-byteoffset.js b/test/built-ins/DataView/prototype/setInt8/return-abrupt-from-tonumber-byteoffset.js
new file mode 100644
index 0000000000..21c76e7a07
--- /dev/null
+++ b/test/built-ins/DataView/prototype/setInt8/return-abrupt-from-tonumber-byteoffset.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-dataview.prototype.setint8
+es6id: 24.2.4.15
+description: >
+  Return abrupt from ToNumber(byteOffset)
+info: |
+  24.2.4.15 DataView.prototype.setInt8 ( byteOffset, value )
+
+  1. Let v be the this value.
+  2. Return ? SetViewValue(v, byteOffset, true, "Int8", value).
+
+  24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
+
+  ...
+  4. Let numberIndex be ? ToNumber(requestIndex).
+  ...
+---*/
+
+var buffer = new ArrayBuffer(1);
+var sample = new DataView(buffer, 0);
+
+var bo1 = {
+  valueOf: function() {
+    throw new Test262Error();
+  }
+};
+
+var bo2 = {
+  toString: function() {
+    throw new Test262Error();
+  }
+};
+
+assert.throws(Test262Error, function() {
+  sample.setInt8(bo1, 1);
+}, "valueOf");
+
+assert.throws(Test262Error, function() {
+  sample.setInt8(bo2, 1);
+}, "toString");
diff --git a/test/built-ins/DataView/prototype/setInt8/return-abrupt-from-tonumber-value-symbol.js b/test/built-ins/DataView/prototype/setInt8/return-abrupt-from-tonumber-value-symbol.js
new file mode 100644
index 0000000000..8945b405ad
--- /dev/null
+++ b/test/built-ins/DataView/prototype/setInt8/return-abrupt-from-tonumber-value-symbol.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-dataview.prototype.setint8
+es6id: 24.2.4.15
+description: >
+  Return abrupt from ToNumber(symbol value)
+info: |
+  24.2.4.15 DataView.prototype.setInt8 ( byteOffset, value )
+
+  1. Let v be the this value.
+  2. Return ? SetViewValue(v, byteOffset, true, "Int8", value).
+
+  24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
+
+  ...
+  7. Let numberValue be ? ToNumber(value).
+  ...
+features: [Symbol]
+---*/
+
+var buffer = new ArrayBuffer(8);
+var sample = new DataView(buffer, 0);
+
+var s = Symbol("1");
+
+assert.throws(TypeError, function() {
+  sample.setInt8(0, s);
+});
diff --git a/test/built-ins/DataView/prototype/setInt8/return-abrupt-from-tonumber-value.js b/test/built-ins/DataView/prototype/setInt8/return-abrupt-from-tonumber-value.js
new file mode 100644
index 0000000000..0cfe5cf66c
--- /dev/null
+++ b/test/built-ins/DataView/prototype/setInt8/return-abrupt-from-tonumber-value.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-dataview.prototype.setint8
+es6id: 24.2.4.15
+description: >
+  Return abrupt from ToNumber(value)
+info: |
+  24.2.4.15 DataView.prototype.setInt8 ( byteOffset, value )
+
+  1. Let v be the this value.
+  2. Return ? SetViewValue(v, byteOffset, true, "Int8", value).
+
+  24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
+
+  ...
+  7. Let numberValue be ? ToNumber(value).
+  ...
+---*/
+
+var buffer = new ArrayBuffer(8);
+var sample = new DataView(buffer, 0);
+
+var bo1 = {
+  valueOf: function() {
+    throw new Test262Error();
+  }
+};
+
+var bo2 = {
+  toString: function() {
+    throw new Test262Error();
+  }
+};
+
+assert.throws(Test262Error, function() {
+  sample.setInt8(0, bo1);
+}, "valueOf");
+
+assert.throws(Test262Error, function() {
+  sample.setInt8(0, bo2);
+}, "toString");
diff --git a/test/built-ins/DataView/prototype/setInt8/set-values-return-undefined.js b/test/built-ins/DataView/prototype/setInt8/set-values-return-undefined.js
new file mode 100644
index 0000000000..76d32b97b2
--- /dev/null
+++ b/test/built-ins/DataView/prototype/setInt8/set-values-return-undefined.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-dataview.prototype.setint8
+es6id: 24.2.4.15
+description: >
+  Set values and return undefined
+info: |
+  24.2.4.15 DataView.prototype.setInt8 ( byteOffset, value )
+
+  1. Let v be the this value.
+  2. Return ? SetViewValue(v, byteOffset, true, "Int8", value).
+
+  24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
+
+  ...
+  15. Let bufferIndex be getIndex + viewOffset.
+  16. Return SetValueInBuffer(buffer, bufferIndex, type, numberValue, isLittleEndian).
+
+  24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , isLittleEndian ] )
+
+  ...
+  11. Store the individual bytes of rawBytes into block, in order, starting at
+  block[byteIndex].
+  12. Return NormalCompletion(undefined).
+features: [DataView.prototype.getInt8]
+includes: [byteConversionValues.js]
+---*/
+
+var buffer = new ArrayBuffer(8);
+var sample = new DataView(buffer, 0);
+
+var values = byteConversionValues.values;
+var expectedValues = byteConversionValues.expected.Int8;
+
+values.forEach(function(value, i) {
+  var expected = expectedValues[i];
+
+  var result = sample.setInt8(0, value);
+
+  assert.sameValue(
+    sample.getInt8(0),
+    expected,
+    "value: " + value
+  );
+  assert.sameValue(
+    result,
+    undefined,
+    "return is undefined, value: " + value
+  );
+});
diff --git a/test/built-ins/DataView/prototype/setInt8/this-has-no-dataview-internal.js b/test/built-ins/DataView/prototype/setInt8/this-has-no-dataview-internal.js
new file mode 100644
index 0000000000..2468a3fc3e
--- /dev/null
+++ b/test/built-ins/DataView/prototype/setInt8/this-has-no-dataview-internal.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-dataview.prototype.setint8
+es6id: 24.2.4.15
+description: >
+  Throws a TypeError if this does not have a [[DataView]] internal slot
+info: |
+  24.2.4.15 DataView.prototype.setInt8 ( byteOffset, value )
+
+  1. Let v be the this value.
+  2. Return ? SetViewValue(v, byteOffset, true, "Int8", value).
+
+  24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
+
+  1. If Type(view) is not Object, throw a TypeError exception.
+  2. If view does not have a [[DataView]] internal slot, throw a TypeError
+  exception.
+  ...
+features: [Int8Array]
+---*/
+
+var setInt8 = DataView.prototype.setInt8;
+
+assert.throws(TypeError, function() {
+  setInt8.call({});
+}, "{}");
+
+assert.throws(TypeError, function() {
+  setInt8.call([]);
+}, "[]");
+
+var ab = new ArrayBuffer(1);
+assert.throws(TypeError, function() {
+  setInt8.call(ab);
+}, "ArrayBuffer");
+
+var ta = new Int8Array();
+assert.throws(TypeError, function() {
+  setInt8.call(ta);
+}, "TypedArray");
diff --git a/test/built-ins/DataView/prototype/setInt8/this-is-not-object.js b/test/built-ins/DataView/prototype/setInt8/this-is-not-object.js
new file mode 100644
index 0000000000..bffb24b9e2
--- /dev/null
+++ b/test/built-ins/DataView/prototype/setInt8/this-is-not-object.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-dataview.prototype.setint8
+es6id: 24.2.4.15
+description: Throws a TypeError if this is not Object
+info: |
+  24.2.4.15 DataView.prototype.setInt8 ( byteOffset, value )
+
+  1. Let v be the this value.
+  2. Return ? SetViewValue(v, byteOffset, true, "Int8", value).
+
+  24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
+
+  1. If Type(view) is not Object, throw a TypeError exception.
+  ...
+features: [Symbol]
+---*/
+
+var setInt8 = DataView.prototype.setInt8;
+
+assert.throws(TypeError, function() {
+  setInt8.call(undefined);
+}, "undefined");
+
+assert.throws(TypeError, function() {
+  setInt8.call(null);
+}, "null");
+
+assert.throws(TypeError, function() {
+  setInt8.call(1);
+}, "1");
+
+assert.throws(TypeError, function() {
+  setInt8.call("string");
+}, "string");
+
+assert.throws(TypeError, function() {
+  setInt8.call(true);
+}, "true");
+
+assert.throws(TypeError, function() {
+  setInt8.call(false);
+}, "false");
+
+var s = Symbol("1");
+assert.throws(TypeError, function() {
+  setInt8.call(s);
+}, "symbol");
-- 
GitLab