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

Unified Diff: test/mjsunit/array-reduce.js

Issue 2752273003: [builtins] Implement Array.prototype.reduce in the CSA (Closed)
Patch Set: Simplify Created 3 years, 9 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
« src/builtins/builtins-array-gen.cc ('K') | « src/debug/debug-evaluate.cc ('k') | no next file » | 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 94e51440b154edb6dc2a6ae9f2b0cf10ca2f9343..f34d3ef6ff2439c412501af9457ef03ccab5355e 100644
--- a/test/mjsunit/array-reduce.js
+++ b/test/mjsunit/array-reduce.js
@@ -408,6 +408,12 @@ testReduce("reduceRight", "ArrayWithNonElementPropertiesReduceRight", 6,
[5, 1, 0, arrayPlus, 6],
], arrayPlus, sum, 0);
+// Test passing undefined as initial value (to test missing parameter
+// detection).
+[1].reduce((a, b) => { assertEquals(a, undefined); assertEquals(b, 1) },
+ undefined);
+[1, 2].reduce((a, b) => { assertEquals(a, 1); assertEquals(b, 2); });
+[1].reduce((a, b) => { assertTrue(false); });
// Test error conditions:
« src/builtins/builtins-array-gen.cc ('K') | « src/debug/debug-evaluate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698