Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: e267414689
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 48 lines (40 sloc) 1.007 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
use v6;
use Test;

plan 9;

# L<S03/Item assignment precedence/bind and make readonly>

{
    my $x = 5;
    my $y = 3;
    $x ::= $y;
    is $x, 3, '::= on scalars took the value from the RHS';
    #?rakudo todo 'nom regression'
    #?pugs todo
    dies_ok { $x = 5 }; '... and made the LHS RO';
    #?rakudo todo 'nom regression'
    #?pugs todo
    is $x, 3, 'variable is still 3';
}

#?pugs todo
{
    my Int $a = 4;
    my Str $b;
    dies_ok { $b ::= $a },
        'Cannot ro-bind variables with incompatible type constraints';
}

{
    my @x = <a b c>;
    my @y = <d e>;

    @x ::= @y;
    is @x.join('|'), 'd|e', '::= on arrays';
    #?rakudo 4 todo '::= on arrays'
    #?niecza todo
    #?pugs 4 todo
    dies_ok { @x := <3 4 foo> }, '... make RO';
    #?niecza todo
    is @x.join('|'), 'd|e', 'value unchanged';
    #?niecza todo
    lives_ok { @x[2] = 'k' }, 'can still assign to items of RO array';
    #?niecza todo
    is @x.join(''), 'd|e|k', 'assignment relly worked';
}

# vim: ft=perl6
Something went wrong with that request. Please try again.