summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/harmony
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2013-04-19 10:50:44 -0700
committerisaacs <i@izs.me>2013-04-19 10:50:44 -0700
commit50624a50ee484b8a53cd4f1155e4e53f19c803be (patch)
tree37c4d13efd0b9f615eceaff99ef31dd411da6696 /deps/v8/test/mjsunit/harmony
parent90266750617adb1ce1ca4ce43fe48f9b0fa11343 (diff)
downloadnode-new-50624a50ee484b8a53cd4f1155e4e53f19c803be.tar.gz
V8: Upgrade to 3.18.1
Diffstat (limited to 'deps/v8/test/mjsunit/harmony')
-rw-r--r--deps/v8/test/mjsunit/harmony/generators-objects.js27
-rw-r--r--deps/v8/test/mjsunit/harmony/typedarrays.js2
2 files changed, 28 insertions, 1 deletions
diff --git a/deps/v8/test/mjsunit/harmony/generators-objects.js b/deps/v8/test/mjsunit/harmony/generators-objects.js
index 0c36818c8e..b717c303c8 100644
--- a/deps/v8/test/mjsunit/harmony/generators-objects.js
+++ b/deps/v8/test/mjsunit/harmony/generators-objects.js
@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --harmony-generators --harmony-scoping
+// Flags: --harmony-generators --harmony-scoping --allow-natives-syntax
// Test instantations of generators.
@@ -55,6 +55,8 @@ function TestGeneratorObject() {
var iter = g();
assertSame(g.prototype, Object.getPrototypeOf(iter));
assertTrue(iter instanceof g);
+ assertEquals("Generator", %ClassOf(iter));
+ assertEquals("[object Generator]", String(iter));
assertEquals([], Object.getOwnPropertyNames(iter));
assertTrue(iter !== g());
@@ -62,7 +64,30 @@ function TestGeneratorObject() {
iter = new g();
assertSame(g.prototype, Object.getPrototypeOf(iter));
assertTrue(iter instanceof g);
+ assertEquals("Generator", %ClassOf(iter));
+ assertEquals("[object Generator]", String(iter));
assertEquals([], Object.getOwnPropertyNames(iter));
assertTrue(iter !== new g());
}
TestGeneratorObject();
+
+
+// Test the methods of generator objects.
+function TestGeneratorObjectMethods() {
+ function* g() { yield 1; }
+ var iter = g();
+
+ function TestNonGenerator(non_generator) {
+ assertThrows(function() { iter.next.call(non_generator); }, TypeError);
+ assertThrows(function() { iter.send.call(non_generator, 1); }, TypeError);
+ assertThrows(function() { iter.throw.call(non_generator, 1); }, TypeError);
+ assertThrows(function() { iter.close.call(non_generator); }, TypeError);
+ }
+
+ TestNonGenerator(1);
+ TestNonGenerator({});
+ TestNonGenerator(function(){});
+ TestNonGenerator(g);
+ TestNonGenerator(g.prototype);
+}
+TestGeneratorObjectMethods();
diff --git a/deps/v8/test/mjsunit/harmony/typedarrays.js b/deps/v8/test/mjsunit/harmony/typedarrays.js
index 75ff3da42e..7f9c7631cd 100644
--- a/deps/v8/test/mjsunit/harmony/typedarrays.js
+++ b/deps/v8/test/mjsunit/harmony/typedarrays.js
@@ -45,9 +45,11 @@ function TestArrayBufferCreation() {
TestByteLength(0, 0);
+/* TODO[dslomov]: Reenable the test
assertThrows(function() {
var ab1 = new __ArrayBuffer(0xFFFFFFFFFFFF)
}, RangeError);
+*/
var ab = new __ArrayBuffer();
assertSame(0, ab.byteLength);