Index: test/mjsunit/harmony/reflect-get-own-property-descriptor.js |
diff --git a/test/mjsunit/get-own-property-descriptor.js b/test/mjsunit/harmony/reflect-get-own-property-descriptor.js |
similarity index 79% |
copy from test/mjsunit/get-own-property-descriptor.js |
copy to test/mjsunit/harmony/reflect-get-own-property-descriptor.js |
index 159c63bcc1f7e7c8698fd92e654e070c8a56427a..3cbffea78bf70637822483a5c7133c8bacd6321e 100644 |
--- a/test/mjsunit/get-own-property-descriptor.js |
+++ b/test/mjsunit/harmony/reflect-get-own-property-descriptor.js |
@@ -1,4 +1,4 @@ |
-// Copyright 2010 the V8 project authors. All rights reserved. |
+// Copyright 2015 the V8 project authors. All rights reserved. |
// Redistribution and use in source and binary forms, with or without |
// modification, are permitted provided that the following conditions are |
// met: |
@@ -27,8 +27,10 @@ |
// This file only tests very simple descriptors that always have |
// configurable, enumerable, and writable set to true. |
-// A range of more elaborate tests are performed in |
-// object-define-property.js |
+ |
+// This is adapted from mjsunit/get-own-property-descriptor.js. |
+ |
+// Flags: --harmony-reflect |
function get() { return x; } |
function set(x) { this.x = x; } |
@@ -40,30 +42,30 @@ var a = new Array(); |
a[1] = 42; |
obj[1] = 42; |
-var descIsData = Object.getOwnPropertyDescriptor(obj, 'x'); |
+var descIsData = Reflect.getOwnPropertyDescriptor(obj, 'x'); |
assertTrue(descIsData.enumerable); |
assertTrue(descIsData.writable); |
assertTrue(descIsData.configurable); |
-var descIsAccessor = Object.getOwnPropertyDescriptor(obj, 'accessor'); |
+var descIsAccessor = Reflect.getOwnPropertyDescriptor(obj, 'accessor'); |
assertTrue(descIsAccessor.enumerable); |
assertTrue(descIsAccessor.configurable); |
assertTrue(descIsAccessor.get == get); |
assertTrue(descIsAccessor.set == set); |
-var descIsNotData = Object.getOwnPropertyDescriptor(obj, 'not-x'); |
+var descIsNotData = Reflect.getOwnPropertyDescriptor(obj, 'not-x'); |
assertTrue(descIsNotData == undefined); |
-var descIsNotAccessor = Object.getOwnPropertyDescriptor(obj, 'not-accessor'); |
+var descIsNotAccessor = Reflect.getOwnPropertyDescriptor(obj, 'not-accessor'); |
assertTrue(descIsNotAccessor == undefined); |
-var descArray = Object.getOwnPropertyDescriptor(a, '1'); |
+var descArray = Reflect.getOwnPropertyDescriptor(a, '1'); |
assertTrue(descArray.enumerable); |
assertTrue(descArray.configurable); |
assertTrue(descArray.writable); |
assertEquals(descArray.value, 42); |
-var descObjectElement = Object.getOwnPropertyDescriptor(obj, '1'); |
+var descObjectElement = Reflect.getOwnPropertyDescriptor(obj, '1'); |
assertTrue(descObjectElement.enumerable); |
assertTrue(descObjectElement.configurable); |
assertTrue(descObjectElement.writable); |
@@ -72,7 +74,7 @@ assertEquals(descObjectElement.value, 42); |
// String objects. |
var a = new String('foobar'); |
for (var i = 0; i < a.length; i++) { |
- var descStringObject = Object.getOwnPropertyDescriptor(a, i); |
+ var descStringObject = Reflect.getOwnPropertyDescriptor(a, i); |
assertTrue(descStringObject.enumerable); |
assertFalse(descStringObject.configurable); |
assertFalse(descStringObject.writable); |
@@ -82,13 +84,13 @@ for (var i = 0; i < a.length; i++) { |
// Support for additional attributes on string objects. |
a.x = 42; |
a[10] = 'foo'; |
-var descStringProperty = Object.getOwnPropertyDescriptor(a, 'x'); |
+var descStringProperty = Reflect.getOwnPropertyDescriptor(a, 'x'); |
assertTrue(descStringProperty.enumerable); |
assertTrue(descStringProperty.configurable); |
assertTrue(descStringProperty.writable); |
assertEquals(descStringProperty.value, 42); |
-var descStringElement = Object.getOwnPropertyDescriptor(a, '10'); |
+var descStringElement = Reflect.getOwnPropertyDescriptor(a, '10'); |
assertTrue(descStringElement.enumerable); |
assertTrue(descStringElement.configurable); |
assertTrue(descStringElement.writable); |
@@ -101,7 +103,7 @@ proto[10] = 42; |
var objWithProto = new Array(); |
objWithProto.prototype = proto; |
objWithProto[0] = 'bar'; |
-var descWithProto = Object.getOwnPropertyDescriptor(objWithProto, '10'); |
+var descWithProto = Reflect.getOwnPropertyDescriptor(objWithProto, '10'); |
assertEquals(undefined, descWithProto); |
// Test elements on global proxy object. |
@@ -113,9 +115,9 @@ function el_getter() { return 239; }; |
function el_setter() {}; |
Object.defineProperty(global, '239', {get: el_getter, set: el_setter}); |
-var descRegularElement = Object.getOwnPropertyDescriptor(global, '42'); |
+var descRegularElement = Reflect.getOwnPropertyDescriptor(global, '42'); |
assertEquals(42, descRegularElement.value); |
-var descAccessorElement = Object.getOwnPropertyDescriptor(global, '239'); |
+var descAccessorElement = Reflect.getOwnPropertyDescriptor(global, '239'); |
assertEquals(el_getter, descAccessorElement.get); |
assertEquals(el_setter, descAccessorElement.set); |