aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/List-Gather-Simple.t27
1 files changed, 27 insertions, 0 deletions
diff --git a/t/List-Gather-Simple.t b/t/List-Gather-Simple.t
new file mode 100644
index 0000000..5ed72d6
--- /dev/null
+++ b/t/List-Gather-Simple.t
@@ -0,0 +1,27 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More;
+BEGIN { use_ok('List::Gather::Simple') };
+
+is_deeply [gather { take 1; take 2 }], [1,2], "double take";
+is_deeply [gather { take for (1,2) }], [1,2], "take implicit argument";
+is_deeply [gather { take for gather { take 1 } }], [1], "nested gather";
+is_deeply [gather {
+ @gathered = (1);
+ take 2;
+ push @gathered, 3;
+}], [1,2,3], "@gathered";
+is_deeply [gather {
+ @gathered = (1);
+ take gather {
+ @gathered = (0);
+ };
+ take 2;
+ push @gathered, 3;
+}], [1,0,2,3], "nested @gathered";
+is_deeply [gather { take 1 }, @gathered], [1], "localized @gathered";
+
+done_testing;