Index: test/mjsunit/object-define-property.js |
diff --git a/test/mjsunit/object-define-property.js b/test/mjsunit/object-define-property.js |
index a8a32130c433ace2cfe465e094a99e1c936048fa..e08686ec52d9cb274bda67d402e3ebcd181270f9 100644 |
--- a/test/mjsunit/object-define-property.js |
+++ b/test/mjsunit/object-define-property.js |
@@ -30,28 +30,34 @@ |
// Flags: --allow-natives-syntax |
// Check that an exception is thrown when null is passed as object. |
+var exception = false; |
try { |
Object.defineProperty(null, null, null); |
- assertTrue(false); |
} catch (e) { |
+ exception = true; |
assertTrue(/called on non-object/.test(e)); |
} |
+assertTrue(exception); |
// Check that an exception is thrown when undefined is passed as object. |
+exception = false; |
try { |
Object.defineProperty(undefined, undefined, undefined); |
- assertTrue(false); |
} catch (e) { |
+ exception = true; |
assertTrue(/called on non-object/.test(e)); |
} |
+assertTrue(exception); |
// Check that an exception is thrown when non-object is passed as object. |
+exception = false; |
try { |
Object.defineProperty(0, "foo", undefined); |
- assertTrue(false); |
} catch (e) { |
+ exception = true; |
assertTrue(/called on non-object/.test(e)); |
} |
+assertTrue(exception); |
// Object. |
var obj1 = {}; |
@@ -695,12 +701,14 @@ Object.defineProperty(obj5, 'minuszero', descMinusZero); |
// Make sure we can redefine with -0. |
Object.defineProperty(obj5, 'minuszero', descMinusZero); |
+exception = false; |
try { |
Object.defineProperty(obj5, 'minuszero', descPlusZero); |
- assertUnreachable(); |
} catch (e) { |
+ exception = true; |
assertTrue(/Cannot redefine property/.test(e)); |
} |
+assertTrue(exception); |
Object.defineProperty(obj5, 'pluszero', descPlusZero); |
@@ -708,12 +716,14 @@ Object.defineProperty(obj5, 'pluszero', descPlusZero); |
// Make sure we can redefine with +0. |
Object.defineProperty(obj5, 'pluszero', descPlusZero); |
+exception = false; |
try { |
Object.defineProperty(obj5, 'pluszero', descMinusZero); |
- assertUnreachable(); |
} catch (e) { |
+ exception = true; |
assertTrue(/Cannot redefine property/.test(e)); |
} |
+assertTrue(exception); |
var obj6 = {}; |
@@ -761,13 +771,15 @@ try { |
// Ensure that we can't change the descriptor of a |
// non configurable property. |
+exception = false; |
try { |
var descAccessor = { get: function() { return 0; } }; |
Object.defineProperty(obj6, '2', descAccessor); |
- assertUnreachable(); |
} catch (e) { |
+ exception = true; |
assertTrue(/Cannot redefine property/.test(e)); |
} |
+assertTrue(exception); |
Object.defineProperty(obj6, '2', descElementNonWritable); |
desc = Object.getOwnPropertyDescriptor(obj6, '2'); |
@@ -858,13 +870,15 @@ try { |
// Ensure that we can't change the descriptor of a |
// non configurable property. |
+exception = false; |
try { |
var descAccessor = { get: function() { return 0; } }; |
Object.defineProperty(arr, '2', descAccessor); |
- assertUnreachable(); |
} catch (e) { |
+ exception = true; |
assertTrue(/Cannot redefine property/.test(e)); |
} |
+assertTrue(exception); |
Object.defineProperty(arr, '2', descElementNonWritable); |
desc = Object.getOwnPropertyDescriptor(arr, '2'); |