From bdc020126a6b59f3a7b866ba72f6ca22a52f8e6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Wed, 5 May 2021 20:02:23 +0200 Subject: First commit --- t/List-Gather-Simple.t | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 t/List-Gather-Simple.t (limited to 't') 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; -- cgit v1.2.3