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

Unified Diff: test/mjsunit/array-reduce.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 | « no previous file | test/mjsunit/function-call.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/array-reduce.js
diff --git a/test/mjsunit/array-reduce.js b/test/mjsunit/array-reduce.js
index 83d9023a49f0a5d9417315e8bcc9282ace30d75e..1e96188265c9a4215eaf499475ca94c3bb4d43d3 100755
--- a/test/mjsunit/array-reduce.js
+++ b/test/mjsunit/array-reduce.js
@@ -411,67 +411,77 @@ testReduce("reduceRight", "ArrayWithNonElementPropertiesReduceRight", 6,
// Test error conditions:
+var exception = false;
try {
[1].reduce("not a function");
- assertUnreachable("Reduce callback not a function not throwing");
} catch (e) {
+ exception = true;
assertTrue(e instanceof TypeError,
"reduce callback not a function not throwing TypeError");
assertEquals("called_non_callable", e.type,
"reduce non function TypeError type");
}
+assertTrue(exception);
+exception = false;
try {
[1].reduceRight("not a function");
- assertUnreachable("ReduceRight callback not a function not throwing");
} catch (e) {
+ exception = true;
assertTrue(e instanceof TypeError,
"reduceRight callback not a function not throwing TypeError");
assertEquals("called_non_callable", e.type,
"reduceRight non function TypeError type");
}
+assertTrue(exception);
-
+exception = false;
try {
[].reduce(sum);
- assertUnreachable("Reduce no initial value not throwing");
} catch (e) {
+ exception = true;
assertTrue(e instanceof TypeError,
"reduce no initial value not throwing TypeError");
assertEquals("reduce_no_initial", e.type,
"reduce no initial TypeError type");
}
+assertTrue(exception);
+exception = false;
try {
[].reduceRight(sum);
- assertUnreachable("ReduceRight no initial value not throwing");
} catch (e) {
+ exception = true;
assertTrue(e instanceof TypeError,
"reduceRight no initial value not throwing TypeError");
assertEquals("reduce_no_initial", e.type,
"reduceRight no initial TypeError type");
}
+assertTrue(exception);
-
+exception = false;
try {
[,,,].reduce(sum);
- assertUnreachable("Reduce sparse no initial value not throwing");
} catch (e) {
+ exception = true;
assertTrue(e instanceof TypeError,
"reduce sparse no initial value not throwing TypeError");
assertEquals("reduce_no_initial", e.type,
"reduce no initial TypeError type");
}
+assertTrue(exception);
+exception = false;
try {
[,,,].reduceRight(sum);
- assertUnreachable("ReduceRight sparse no initial value not throwing");
} catch (e) {
+ exception = true;
assertTrue(e instanceof TypeError,
"reduceRight sparse no initial value not throwing TypeError");
assertEquals("reduce_no_initial", e.type,
"reduceRight no initial TypeError type");
}
+assertTrue(exception);
// Array changing length
@@ -511,4 +521,3 @@ testReduce("reduce", "ArrayManipulationExtender", 10,
[3, 3, 2, [1, 2, 3, 4, 4, 5], 6],
[6, 4, 3, [1, 2, 3, 4, 4, 5, 6], 10],
], arr, extender, 0);
-
« no previous file with comments | « no previous file | test/mjsunit/function-call.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698