summaryrefslogtreecommitdiff
path: root/test/built-ins/Object/defineProperty/15.2.3.6-4-591.js
diff options
context:
space:
mode:
authorsmikes <smikes@cubane.com>2015-05-06 13:26:45 -0600
committersmikes <smikes@cubane.com>2015-05-06 13:57:54 -0600
commit26ede592a8cb0c09cc640baa867d1b2eea38e535 (patch)
tree49055b05358f5966d0d2fdc8ebafa72a77026a29 /test/built-ins/Object/defineProperty/15.2.3.6-4-591.js
parent08575d89b73e5c48365f1eb631fb1436736fae7f (diff)
downloadqtdeclarative-testsuites-26ede592a8cb0c09cc640baa867d1b2eea38e535.tar.gz
fix tests in strict mode - Object/defineProperty
Diffstat (limited to 'test/built-ins/Object/defineProperty/15.2.3.6-4-591.js')
-rw-r--r--test/built-ins/Object/defineProperty/15.2.3.6-4-591.js102
1 files changed, 56 insertions, 46 deletions
diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-591.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-591.js
index c063f60b7..699305d7d 100644
--- a/test/built-ins/Object/defineProperty/15.2.3.6-4-591.js
+++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-591.js
@@ -9,51 +9,61 @@ es5id: 15.2.3.6-4-591
description: >
ES5 Attributes - Fail to update value of property of
[[Proptotype]] internal property (Object.create)
-includes: [runTestCase.js]
+includes: [propertyHelper.js]
---*/
-function testcase() {
- var appointment = {};
-
- var data1 = 1001;
- Object.defineProperty(appointment, "startTime", {
- get: function () {
- return data1;
- },
- enumerable: false,
- configurable: false
- });
- var data2 = "NAME";
- Object.defineProperty(appointment, "name", {
- get: function () {
- return data2;
- },
- enumerable: false,
- configurable: true
- });
-
- var meeting = Object.create(appointment);
- var data3 = "In-person meeting";
- Object.defineProperty(meeting, "conferenceCall", {
- get: function () {
- return data3;
- },
- enumerable: false,
- configurable: false
- });
-
- var teamMeeting = Object.create(meeting);
- teamMeeting.name = "IE Team Meeting";
- var dateObj = new Date("10/31/2010 08:00");
- teamMeeting.startTime = dateObj;
- teamMeeting.conferenceCall = "4255551212";
-
- var hasOwnProperty = !teamMeeting.hasOwnProperty("name") &&
- !teamMeeting.hasOwnProperty("startTime") &&
- !teamMeeting.hasOwnProperty('conferenceCall');
-
- return hasOwnProperty && teamMeeting.name === "NAME" &&
- teamMeeting.startTime === 1001 &&
- teamMeeting.conferenceCall === "In-person meeting";
- }
-runTestCase(testcase);
+var appointment = {};
+
+var data1 = 1001;
+Object.defineProperty(appointment, "startTime", {
+ get: function () {
+ return data1;
+ },
+ enumerable: false,
+ configurable: false
+});
+var data2 = "NAME";
+Object.defineProperty(appointment, "name", {
+ get: function () {
+ return data2;
+ },
+ enumerable: false,
+ configurable: true
+});
+
+var meeting = Object.create(appointment);
+var data3 = "In-person meeting";
+Object.defineProperty(meeting, "conferenceCall", {
+ get: function () {
+ return data3;
+ },
+ enumerable: false,
+ configurable: false
+});
+
+var teamMeeting = Object.create(meeting);
+
+verifyNotWritable(teamMeeting, "name", "nocheck");
+verifyNotWritable(teamMeeting, "startTime", "nocheck");
+verifyNotWritable(teamMeeting, "conferenceCall", "nocheck");
+
+try {
+ teamMeeting.name = "IE Team Meeting";
+} catch (e) {}
+
+try {
+ var dateObj = new Date("10/31/2010 08:00");
+ teamMeeting.startTime = dateObj;
+} catch (e) {}
+
+try {
+ teamMeeting.conferenceCall = "4255551212";
+} catch (e) {}
+
+assert(!teamMeeting.hasOwnProperty("name"));
+assert(!teamMeeting.hasOwnProperty("startTime"));
+assert(!teamMeeting.hasOwnProperty('conferenceCall'));
+
+assert.sameValue(teamMeeting.name, "NAME");
+assert.sameValue(teamMeeting.startTime, 1001);
+assert.sameValue(teamMeeting.conferenceCall, "In-person meeting");