use v6;
use Test;

plan 5;

# L<S06/Pairs as lvalues/>

throws-like 'my $var; (key => $var) = "value"', X::Assignment::RO;

#?rakudo todo "NYI RT #124660"
{
    my ($a, $b);
    $b = 'b';
    :(:$a) := $b;
    is $a, 'b', 'can bind to single pair';
    ok $a =:= $b, 'variables are bound together (?)';
}

{
    my ($t, $m);
    :(:type($t), :motivation($m)) := (type => 'geek', motivation => '-Ofun');
    is $t, 'geek',  'bound to the first pair';
    is $m, '-Ofun', 'bound to the second pair';
}




# vim: ft=perl6

use v6;
use Test;

plan 5;

# L<S06/Pairs as lvalues/>

throws-like 'my $var; (key => $var) = "value"', X::Assignment::RO;

#?rakudo todo "NYI RT #124660"
{
    my ($a, $b);
    $b = 'b';
    :(:$a) := \(:a($b));
    is $a, 'b', 'can bind to single pair';
    ok $a =:= $b, 'variables are bound together (?)';
}

{
    my ($t, $m);
    :(:type($t), :motivation($m)) := (type => 'geek', motivation => '-Ofun');
    is $t, 'geek',  'bound to the first pair';
    is $m, '-Ofun', 'bound to the second pair';
}




# vim: ft=perl6

Fix and unfudge incorrect Pair binding test
Fix and unfudge incorrect Pair binding test

The current version attempts to bind a Str variable to a Signature
with one named arg in it. The test is fudged, as :$a gets a Mu
value instead of $b's value, and it doesn't outright die only
because Str.Capture returns an empty capture.

Fix by binding a proper Capture, with $b passed as a named :a arg.
