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

Unified Diff: test/mjsunit/function-call.js

Issue 11358214: Remove 'type' and 'arguments' properties from Error object. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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
Index: test/mjsunit/function-call.js
diff --git a/test/mjsunit/function-call.js b/test/mjsunit/function-call.js
index 26890ed113c8bdeaa4376dc3ad39f4b752a11b75..390ab977ebf3a4b7c3ec4de20236a43c8bd4ecaf 100644
--- a/test/mjsunit/function-call.js
+++ b/test/mjsunit/function-call.js
@@ -150,6 +150,11 @@ var reducing_functions =
[Array.prototype.reduce,
Array.prototype.reduceRight];
+function checkExpectedMessage(e) {
+ assertTrue(e.message.indexOf("called on null or undefined") >= 0 ||
+ e.message.indexOf("Cannot convert null to object") >= 0);
+}
+
// Test that all natives using the ToObject call throw the right exception.
for (var i = 0; i < should_throw_on_null_and_undefined.length; i++) {
// Sanity check that all functions are correct
@@ -166,8 +171,7 @@ for (var i = 0; i < should_throw_on_null_and_undefined.length; i++) {
should_throw_on_null_and_undefined[i].call(null);
} catch (e) {
exception = true;
- assertTrue("called_on_null_or_undefined" == e.type ||
- "null_to_object" == e.type);
+ checkExpectedMessage(e);
}
assertTrue(exception);
@@ -176,8 +180,7 @@ for (var i = 0; i < should_throw_on_null_and_undefined.length; i++) {
should_throw_on_null_and_undefined[i].call(undefined);
} catch (e) {
exception = true;
- assertTrue("called_on_null_or_undefined" == e.type ||
- "null_to_object" == e.type);
+ checkExpectedMessage(e);
}
assertTrue(exception);
@@ -186,8 +189,7 @@ for (var i = 0; i < should_throw_on_null_and_undefined.length; i++) {
should_throw_on_null_and_undefined[i].apply(null);
} catch (e) {
exception = true;
- assertTrue("called_on_null_or_undefined" == e.type ||
- "null_to_object" == e.type);
+ checkExpectedMessage(e);
}
assertTrue(exception);
@@ -196,8 +198,7 @@ for (var i = 0; i < should_throw_on_null_and_undefined.length; i++) {
should_throw_on_null_and_undefined[i].apply(undefined);
} catch (e) {
exception = true;
- assertTrue("called_on_null_or_undefined" == e.type ||
- "null_to_object" == e.type);
+ checkExpectedMessage(e);
}
assertTrue(exception);
}
@@ -257,8 +258,7 @@ for (var j = 0; j < mapping_functions.length; j++) {
null);
} catch (e) {
exception = true;
- assertTrue("called_on_null_or_undefined" == e.type ||
- "null_to_object" == e.type);
+ checkExpectedMessage(e);
}
assertTrue(exception);
@@ -269,8 +269,7 @@ for (var j = 0; j < mapping_functions.length; j++) {
undefined);
} catch (e) {
exception = true;
- assertTrue("called_on_null_or_undefined" == e.type ||
- "null_to_object" == e.type);
+ checkExpectedMessage(e);
}
assertTrue(exception);
}
@@ -311,8 +310,7 @@ for (var j = 0; j < reducing_functions.length; j++) {
reducing_functions[j].call(array, should_throw_on_null_and_undefined[i]);
} catch (e) {
exception = true;
- assertTrue("called_on_null_or_undefined" == e.type ||
- "null_to_object" == e.type);
+ checkExpectedMessage(e);
}
assertTrue(exception);
@@ -321,8 +319,7 @@ for (var j = 0; j < reducing_functions.length; j++) {
reducing_functions[j].call(array, should_throw_on_null_and_undefined[i]);
} catch (e) {
exception = true;
- assertTrue("called_on_null_or_undefined" == e.type ||
- "null_to_object" == e.type);
+ checkExpectedMessage(e);
}
assertTrue(exception);
}

Powered by Google App Engine
This is Rietveld 408576698