summaryrefslogtreecommitdiffstats
path: root/t/recursion.t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-08-18 18:34:54 -0500
committerJesse Luehrs <doy@tozt.net>2012-08-18 18:34:54 -0500
commit6d034593a5f0b02eb9e5b7069fa86814aae07b7c (patch)
treecac520e6c8261200f1106d905c9a54ac5eb07883 /t/recursion.t
parent81934f7347d6d0ebaa8713fb2d9962764de724fc (diff)
downloadfun-6d034593a5f0b02eb9e5b7069fa86814aae07b7c.tar.gz
fun-6d034593a5f0b02eb9e5b7069fa86814aae07b7c.zip
initial implementation
Diffstat (limited to 't/recursion.t')
-rw-r--r--t/recursion.t25
1 files changed, 25 insertions, 0 deletions
diff --git a/t/recursion.t b/t/recursion.t
new file mode 100644
index 0000000..0b13da9
--- /dev/null
+++ b/t/recursion.t
@@ -0,0 +1,25 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+BEGIN {
+ if (!eval { require 5.016; 1 }) {
+ plan skip_all => "This test requires 5.16";
+ }
+}
+
+use 5.016;
+
+use Fun;
+
+fun fact ($n) {
+ if ($n < 2) {
+ return 1;
+ }
+ return $n * __SUB__->($n - 1);
+}
+
+is(fact(5), 120);
+
+done_testing;