summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-08-22 03:58:12 -0500
committerJesse Luehrs <doy@tozt.net>2012-08-22 03:58:12 -0500
commit946b1782fb842fc82b2cc32058e86f744d227cdb (patch)
tree876f322f6c9cf44c3e84c9bbd0cbe67c717dd976
parent01042240a68d3679b5a2ee67efc43109a05e1f68 (diff)
downloadfun-946b1782fb842fc82b2cc32058e86f744d227cdb.tar.gz
fun-946b1782fb842fc82b2cc32058e86f744d227cdb.zip
test named recursion
-rw-r--r--t/recursion.t9
1 files changed, 9 insertions, 0 deletions
diff --git a/t/recursion.t b/t/recursion.t
index 5c3c29b..81a4cc4 100644
--- a/t/recursion.t
+++ b/t/recursion.t
@@ -24,4 +24,13 @@ is(fact(5), 120);
is(fun ($n = 8) { $n < 2 ? 1 : $n * __SUB__->($n - 1) }->(), 40320);
+fun fact2 ($n) {
+ if ($n < 2) {
+ return 1;
+ }
+ return $n * fact2($n - 1);
+}
+
+is(fact2(5), 120);
+
done_testing;