Skip to content

Commit

Permalink
More coverage for .= calls
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Feb 10, 2018
1 parent c932edc commit cfa9deb
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions S03-operators/inplace.t
Expand Up @@ -263,4 +263,26 @@ subtest '.= inside andthen and relatives' => {
is-deeply $x4, Meow.new(:10a, :20b), 'chain of different ops';
}

subtest 'various weird cases of .= calls' => {
plan 2;

subtest 'nested calls with method name as string in one of them' => {
plan 2;
my $c = 0;
(my Int $x .=new).="{$c++; "new"}"(42);
is-deeply $x, 42, 'right value in .=ed var';
is-deeply $c, 1, 'called block in string only once';
}

subtest 'nested calls with method name as string and do block' => {
plan 3;
my $c = 0;
my $b = 0;
do { $b++; (my Int $x .=new) }.="{$c++; "new"}"(42);
is-deeply $x, 42, 'right value in .=ed var';
is-deeply $b, 1, 'called block in `do` only once';
is-deeply $c, 1, 'called block in string only once';
}
}

# vim: ft=perl6

0 comments on commit cfa9deb

Please sign in to comment.