Revision: 24551
Author: [email protected]
Date: Mon Oct 13 09:48:50 2014 UTC
Log: Fix typedarray tests.
1. Fixed typo. lenght -> length. Arbitary -> Arbitrary.
2. TypedArray DataView property getters should throw TypeError when called
on
incompatible types.
3. Should not use integers as keys in the arbitrary-properties test.
[email protected], [email protected]
Review URL: https://codereview.chromium.org/652603002
Patch from Xueqiao Xu <[email protected]>.
https://code.google.com/p/v8/source/detail?r=24551
Modified:
/branches/bleeding_edge/test/mjsunit/harmony/typedarrays.js
=======================================
--- /branches/bleeding_edge/test/mjsunit/harmony/typedarrays.js Fri Mar 28
15:25:24 2014 UTC
+++ /branches/bleeding_edge/test/mjsunit/harmony/typedarrays.js Mon Oct 13
09:48:50 2014 UTC
@@ -361,14 +361,18 @@
Float64Array];
function TestPropertyTypeChecks(constructor) {
- var a = new constructor();
function CheckProperty(name) {
var d = Object.getOwnPropertyDescriptor(constructor.prototype, name);
- var o = {}
+ var o = {};
assertThrows(function() {d.get.call(o);}, TypeError);
- d.get.call(a); // shouldn't throw
- for (var i = 0 ; i < typedArrayConstructors.length; i++) {
- d.get.call(new typedArrayConstructors[i](10));
+ for (var i = 0; i < typedArrayConstructors.length; i++) {
+ var ctor = typedArrayConstructors[i];
+ var a = new ctor(10);
+ if (ctor === constructor) {
+ d.get.call(a); // shouldn't throw
+ } else {
+ assertThrows(function() {d.get.call(a);}, TypeError);
+ }
}
}
@@ -378,7 +382,7 @@
CheckProperty("length");
}
-for(i = 0; i < typedArrayConstructors.lenght; i++) {
+for(i = 0; i < typedArrayConstructors.length; i++) {
TestPropertyTypeChecks(typedArrayConstructors[i]);
}
@@ -561,7 +565,7 @@
assertArrayEquals([], props(obj));
}
TestEnumerable(ArrayBuffer, new ArrayBuffer());
-for(i = 0; i < typedArrayConstructors.lenght; i++) {
+for(i = 0; i < typedArrayConstructors.length; i++) {
TestEnumerable(typedArrayConstructors[i]);
}
TestEnumerable(DataView, new DataView(new ArrayBuffer()));
@@ -573,13 +577,13 @@
assertEquals(value, map[property]);
}
for (var i = 0; i < 20; i++) {
- TestProperty(m, i, 'val' + i);
+ TestProperty(m, 'key' + i, 'val' + i);
TestProperty(m, 'foo' + i, 'bar' + i);
}
}
TestArbitrary(new ArrayBuffer(256));
-for(i = 0; i < typedArrayConstructors.lenght; i++) {
- TestArbitary(new typedArrayConstructors[i](10));
+for(i = 0; i < typedArrayConstructors.length; i++) {
+ TestArbitrary(new typedArrayConstructors[i](10));
}
TestArbitrary(new DataView(new ArrayBuffer(256)));
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.