aboutsummaryrefslogtreecommitdiff
path: root/t/List-Gather-Simple.t
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-05-05 20:02:23 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-05-05 20:02:23 +0200
commitbdc020126a6b59f3a7b866ba72f6ca22a52f8e6c (patch)
treece17b96a7dc3c4b737339d79c2d3dfc786231ffa /t/List-Gather-Simple.t
downloadList-Gather-Simple-master.tar.gz
First commitHEADmaster
Diffstat (limited to 't/List-Gather-Simple.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;