Index: test/mjsunit/harmony/typedarrays.js |
diff --git a/test/mjsunit/harmony/typedarrays.js b/test/mjsunit/harmony/typedarrays.js |
index e1048ecfaf36ba445d55bc7701b0e9f838a922ae..ef17320408be0e9a4eeaea0151acb6f76ad378c5 100644 |
--- a/test/mjsunit/harmony/typedarrays.js |
+++ b/test/mjsunit/harmony/typedarrays.js |
@@ -35,14 +35,15 @@ function TestByteLength(param, expectedByteLength) { |
function TestArrayBufferCreation() { |
TestByteLength(1, 1); |
TestByteLength(256, 256); |
- TestByteLength(-10, 0); |
TestByteLength(2.567, 2); |
- TestByteLength(-2.567, 0); |
TestByteLength("abc", 0); |
TestByteLength(0, 0); |
+ assertThrows(function() { new ArrayBuffer(-10); }, RangeError); |
+ assertThrows(function() { new ArrayBuffer(-2.567); }, RangeError); |
+ |
/* TODO[dslomov]: Reenable the test |
assertThrows(function() { |
var ab1 = new ArrayBuffer(0xFFFFFFFFFFFF) |
@@ -89,17 +90,20 @@ function TestArrayBufferSlice() { |
TestSlice(0, 0, 1, 20); |
TestSlice(100, 100, 0, 100); |
TestSlice(100, 100, 0, 1000); |
- TestSlice(0, 100, 5, 1); |
+ |
+ assertThrows(function() { new ArrayBuffer(100).slice(5,1); }, RangeError); |
TestSlice(1, 100, -11, -10); |
TestSlice(9, 100, -10, 99); |
- TestSlice(0, 100, -10, 80); |
+ assertThrows( |
+ function () { new ArrayBuffer(100).slice(-10, 80); }, RangeError); |
TestSlice(10, 100, 80, -10); |
TestSlice(10, 100, 90, "100"); |
TestSlice(10, 100, "90", "100"); |
- TestSlice(0, 100, 90, "abc"); |
+ assertThrows( |
+ function() { new ArrayBuffer(100).slice(90,"abc"); }, RangeError); |
TestSlice(10, 100, "abc", 10); |
TestSlice(10, 100, 0.96, 10.96); |
@@ -489,24 +493,15 @@ function TestDataViewConstructor() { |
assertSame(256, d3c.byteOffset); |
assertSame(0, d3c.byteLength); |
- // weird args |
- var d4 = new DataView(ab, -1); |
+ var d4 = new DataView(ab, 1, 3.1415926); |
assertSame(ab, d4.buffer); |
- assertSame(0, d4.byteOffset); |
- assertSame(256, d4.byteLength); |
- |
- var d5 = new DataView(ab, 1, -1); |
- assertSame(ab, d5.buffer); |
- assertSame(1, d5.byteOffset); |
- assertSame(0, d5.byteLength); |
- |
- var d6 = new DataView(ab, 1, 3.1415926); |
- assertSame(ab, d6.buffer); |
- assertSame(1, d6.byteOffset); |
- assertSame(3, d6.byteLength); |
+ assertSame(1, d4.byteOffset); |
+ assertSame(3, d4.byteLength); |
// error cases |
+ assertThrows(function() { new DataView(ab, -1); }, RangeError); |
+ assertThrows(function() { new DataView(ab, 1, -1); }, RangeError); |
assertThrows(function() { new DataView(); }, TypeError); |
assertThrows(function() { new DataView([]); }, TypeError); |
assertThrows(function() { new DataView(ab, 257); }, RangeError); |