ecaa468b68fb223210f8e9b6512f2a286d90b932
[p5sagit/Gather-Once.git] / t / basic.t
1 use strict;
2 use warnings;
3 use Test::More 0.89;
4
5 use Gather::Once
6     block => 'with',
7     take  => 'iff',
8     topicalise => 1,
9     predicate  => sub {
10         warn "$_[0] == $_[1]";
11         $_[0] == $_[1];
12     };
13
14 my $n = 42;
15
16 my @ret = with ($n) {
17     warn 42;
18     iff (42) { 23 };
19     warn 23;
20     42;
21 };
22
23 diag explain \@ret;
24
25 use Gather::Once
26     block => 'moo',
27     take  => 'iff_',
28     predicate  => sub {
29         warn scalar @_;
30         warn "$_[0]";
31         !!$_[0]
32     };
33
34 =for later
35 iff_ (42) { };
36 =cut
37
38 my @ret_ = moo {
39     iff_ (42) { 1, 2, 3 };
40 };
41
42 diag explain \@ret_;
43
44 done_testing;