Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Unified Diff: test/mjsunit/harmony/dataview-accessors.js

Issue 20030004: Make DataView setters throw when only offset is provided. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/typedarray.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/dataview-accessors.js
diff --git a/test/mjsunit/harmony/dataview-accessors.js b/test/mjsunit/harmony/dataview-accessors.js
index c57841c4941a69f4fb85595c61101712f7243f35..7b03da7089721235ce96a85d16afe7b6428513bf 100644
--- a/test/mjsunit/harmony/dataview-accessors.js
+++ b/test/mjsunit/harmony/dataview-accessors.js
@@ -389,6 +389,11 @@ function TestGeneralAccessors() {
f.call(a, 0, 0); // should not throw
assertThrows(function() { f.call({}, 0, 0); }, TypeError);
assertThrows(function() { f.call(a); }, TypeError);
+ if (name.indexOf("set") == 0) {
+ assertThrows(function() { f.call(a, 1); }, TypeError);
+ } else {
+ f.call(a, 1); // should not throw
+ }
}
CheckAccessor("getUint8");
CheckAccessor("setUint8");
@@ -409,3 +414,36 @@ function TestGeneralAccessors() {
}
TestGeneralAccessors();
+
+function TestInsufficientArguments() {
+ var a = new DataView(new ArrayBuffer(256));
+
+ assertThrows(function() { a.getUint8(); }, TypeError);
+ assertThrows(function() { a.getInt8(); }, TypeError);
+ assertThrows(function() { a.getUint16(); }, TypeError);
+ assertThrows(function() { a.getInt16(); }, TypeError);
+ assertThrows(function() { a.getUint32(); }, TypeError);
+ assertThrows(function() { a.getInt32(); }, TypeError);
+ assertThrows(function() { a.getFloat32(); }, TypeError);
+ assertThrows(function() { a.getFloat64(); }, TypeError);
+
+ assertThrows(function() { a.setUint8(); }, TypeError);
+ assertThrows(function() { a.setInt8(); }, TypeError);
+ assertThrows(function() { a.setUint16(); }, TypeError);
+ assertThrows(function() { a.setInt16(); }, TypeError);
+ assertThrows(function() { a.setUint32(); }, TypeError);
+ assertThrows(function() { a.setInt32(); }, TypeError);
+ assertThrows(function() { a.setFloat32(); }, TypeError);
+ assertThrows(function() { a.setFloat64(); }, TypeError);
+
+ assertThrows(function() { a.setUint8(1) }, TypeError);
+ assertThrows(function() { a.setInt8(1) }, TypeError);
+ assertThrows(function() { a.setUint16(1) }, TypeError);
+ assertThrows(function() { a.setInt16(1) }, TypeError);
+ assertThrows(function() { a.setUint32(1) }, TypeError);
+ assertThrows(function() { a.setInt32(1) }, TypeError);
+ assertThrows(function() { a.setFloat32(1) }, TypeError);
+ assertThrows(function() { a.setFloat64(1) }, TypeError);
+}
+
+TestInsufficientArguments();
« no previous file with comments | « src/typedarray.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698