Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Unified Diff: test/mjsunit/object-define-property.js

Issue 7053035: Fix a number of tests that incorrectly used assertUnreachable. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments. Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/function-call.js ('k') | test/mjsunit/object-freeze.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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');
« no previous file with comments | « test/mjsunit/function-call.js ('k') | test/mjsunit/object-freeze.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698