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

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

Issue 7348008: Merge up to 8597 to experimental/gc from the bleeding edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 years, 5 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-bind.js ('k') | test/mjsunit/fuzz-natives.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/function-call.js
===================================================================
--- test/mjsunit/function-call.js (revision 8618)
+++ test/mjsunit/function-call.js (working copy)
@@ -155,6 +155,7 @@
// Sanity check that all functions are correct
assertEquals(typeof(should_throw_on_null_and_undefined[i]), "function");
+ var exception = false;
try {
// We call all functions with no parameters, which means that essential
// parameters will have the undefined value.
@@ -163,68 +164,84 @@
// undefined value is an invalid argument value, it mustn't change
// the result of the test.
should_throw_on_null_and_undefined[i].call(null);
- assertUnreachable();
} catch (e) {
+ exception = true;
assertTrue("called_on_null_or_undefined" == e.type ||
"null_to_object" == e.type);
}
+ assertTrue(exception);
+ exception = false;
try {
should_throw_on_null_and_undefined[i].call(undefined);
- assertUnreachable();
} catch (e) {
+ exception = true;
assertTrue("called_on_null_or_undefined" == e.type ||
"null_to_object" == e.type);
}
+ assertTrue(exception);
+ exception = false;
try {
should_throw_on_null_and_undefined[i].apply(null);
- assertUnreachable();
} catch (e) {
+ exception = true;
assertTrue("called_on_null_or_undefined" == e.type ||
"null_to_object" == e.type);
}
+ assertTrue(exception);
+ exception = false;
try {
should_throw_on_null_and_undefined[i].apply(undefined);
- assertUnreachable();
} catch (e) {
+ exception = true;
assertTrue("called_on_null_or_undefined" == e.type ||
"null_to_object" == e.type);
}
+ assertTrue(exception);
}
// Test that all natives that are non generic throw on null and undefined.
for (var i = 0; i < non_generic.length; i++) {
// Sanity check that all functions are correct
assertEquals(typeof(non_generic[i]), "function");
+
+ exception = false;
try {
non_generic[i].call(null);
- assertUnreachable();
} catch (e) {
+ exception = true;
assertTrue(e instanceof TypeError);
}
+ assertTrue(exception);
+ exception = false;
try {
non_generic[i].call(null);
- assertUnreachable();
} catch (e) {
+ exception = true;
assertTrue(e instanceof TypeError);
}
+ assertTrue(exception);
+ exception = false;
try {
non_generic[i].apply(null);
- assertUnreachable();
} catch (e) {
+ exception = true;
assertTrue(e instanceof TypeError);
}
+ assertTrue(exception);
+ exception = false;
try {
non_generic[i].apply(null);
- assertUnreachable();
} catch (e) {
+ exception = true;
assertTrue(e instanceof TypeError);
}
+ assertTrue(exception);
}
@@ -233,47 +250,55 @@
var array = [1,2,3,4,5];
for (var j = 0; j < mapping_functions.length; j++) {
for (var i = 0; i < should_throw_on_null_and_undefined.length; i++) {
+ exception = false;
try {
mapping_functions[j].call(array,
should_throw_on_null_and_undefined[i],
null);
- assertUnreachable();
} catch (e) {
+ exception = true;
assertTrue("called_on_null_or_undefined" == e.type ||
"null_to_object" == e.type);
}
+ assertTrue(exception);
+ exception = false;
try {
mapping_functions[j].call(array,
should_throw_on_null_and_undefined[i],
undefined);
- assertUnreachable();
} catch (e) {
+ exception = true;
assertTrue("called_on_null_or_undefined" == e.type ||
"null_to_object" == e.type);
}
+ assertTrue(exception);
}
}
for (var j = 0; j < mapping_functions.length; j++) {
for (var i = 0; i < non_generic.length; i++) {
+ exception = false;
try {
mapping_functions[j].call(array,
non_generic[i],
null);
- assertUnreachable();
} catch (e) {
+ exception = true;
assertTrue(e instanceof TypeError);
}
+ assertTrue(exception);
+ exception = false;
try {
mapping_functions[j].call(array,
non_generic[i],
undefined);
- assertUnreachable();
} catch (e) {
+ exception = true;
assertTrue(e instanceof TypeError);
}
+ assertTrue(exception);
}
}
@@ -281,39 +306,47 @@
// Reduce functions do a call with null as this argument.
for (var j = 0; j < reducing_functions.length; j++) {
for (var i = 0; i < should_throw_on_null_and_undefined.length; i++) {
+ exception = false;
try {
reducing_functions[j].call(array, should_throw_on_null_and_undefined[i]);
- assertUnreachable();
} catch (e) {
+ exception = true;
assertTrue("called_on_null_or_undefined" == e.type ||
"null_to_object" == e.type);
}
+ assertTrue(exception);
+ exception = false;
try {
reducing_functions[j].call(array, should_throw_on_null_and_undefined[i]);
- assertUnreachable();
} catch (e) {
+ exception = true;
assertTrue("called_on_null_or_undefined" == e.type ||
"null_to_object" == e.type);
}
+ assertTrue(exception);
}
}
for (var j = 0; j < reducing_functions.length; j++) {
for (var i = 0; i < non_generic.length; i++) {
+ exception = false;
try {
reducing_functions[j].call(array, non_generic[i]);
- assertUnreachable();
} catch (e) {
+ exception = true;
assertTrue(e instanceof TypeError);
}
+ assertTrue(exception);
+ exception = false;
try {
reducing_functions[j].call(array, non_generic[i]);
- assertUnreachable();
} catch (e) {
+ exception = true;
assertTrue(e instanceof TypeError);
}
+ assertTrue(exception);
}
}
« no previous file with comments | « test/mjsunit/function-bind.js ('k') | test/mjsunit/fuzz-natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698