From b4bea5f4e0b43cb8b31aeb0072f8a48a1a8a650c Mon Sep 17 00:00:00 2001 From: rxi Date: Thu, 6 Mar 2014 19:33:33 +0000 Subject: [PATCH] Added new tests for lume.reduce() --- test/test_lume.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/test_lume.lua b/test/test_lume.lua index 7c5c85f..5ad6661 100644 --- a/test/test_lume.lua +++ b/test/test_lume.lua @@ -150,8 +150,14 @@ end -- lume.reduce tests["lume.reduce"] = function() local concat = function(a, b) return a .. b end + local add = function(a, b) return a + b end testeq( lume.reduce({"cat", "dog"}, concat, ""), "catdog" ) testeq( lume.reduce({"cat", "dog"}, concat, "pig"), "pigcatdog" ) + testeq( lume.reduce({"me", "ow"}, concat), "meow" ) + testeq( lume.reduce({1, 2, 3, 4}, add), 10 ) + testeq( lume.reduce({1, 2, 3, 4}, add), 10 ) + testeq( lume.reduce({1}, add), 1 ) + testeq( lume.reduce({}, concat, "potato"), "potato" ) end -- lume.set