use v6;
use Test;
plan 18;
{
my $arrayref = [<a b c>];
my @array = ($arrayref,);
is +@array, 1, '@array = ($arrayref,) does not flatten the arrayref';
}
{
my $arrayref = [<a b c>];
my @array = ($arrayref);
is +@array, 1, '@array = ($arrayref) does not flatten the arrayref';
}
{
my $arrayref = [<a b c>];
my @array = $arrayref;
is +@array, 1, '@array = $arrayref does not flatten the arrayref';
}
{
my $hashref = {:a(1), :b(2), :c(3)};
my %hash;
try { %hash = ($hashref,) };
is +%hash, 0, '%hash = ($hashref,) does not flatten the hashref';
}
{
my $hashref = {:a(1), :b(2), :c(3)};
my %hash = ($hashref);
is +%hash, 0, '%hash = ($hashref) does not flatten the hashref';
}
{
my $hashref = {:a(1), :b(2), :c(3)};
my %hash = $hashref;
is +%hash, 0, '%hash = $hashref does not flatten the hashref';
}
{
my $foo = [<a b c>];
my $bar = ($foo,);
is +$bar, 1, '$bar = ($foo,) does not flatten the arrayref';
}
{
my $foo = [<a b c>];
my $bar = ($foo);
is +$bar, 3, '$bar = ($foo) does flatten the arrayref';
}
{
my $foo = [<a b c>];
my $bar = $foo;
is +$bar, 3, '$bar = $foo does flatten the arrayref';
}
{
my $foo = {:a(1), :b(2), :c(3)};
my $bar = ($foo,);
is +$bar, 1, '$bar = ($foo,) does not flatten the hashref';
}
{
my $foo = {:a(1), :b(2), :c(3)};
my $bar = ($foo);
is +$bar, 3, '$bar = ($foo) does flatten the hashref';
}
{
my $foo = {:a(1), :b(2), :c(3)};
my $bar = $foo;
is +$bar, 3, '$bar = $foo does flatten the hashref';
}
{
my $arrayref = [<a b c>];
my @array;
@array[0] = ($arrayref,);
is +@array, 1, '@array[0] = ($arrayref,) does not flatten the arrayref';
}
{
my $arrayref = [<a b c>];
my @array;
@array[0] = ($arrayref);
is +@array, 1, '@array[0] = ($arrayref) does not flatten the arrayref';
}
{
my $arrayref = [<a b c>];
my @array;
@array[0] = $arrayref;
is +@array, 1, '@array[0] = $arrayref does not flatten the arrayref';
}
{
my $hashref = {:a(1), :b(2), :c(3)};
my %hash;
%hash<a> = ($hashref,);
is +%hash, 1, '%hash<a> = ($hashref,) does not flatten the hashref';
}
{
my $hashref = {:a(1), :b(2), :c(3)};
my %hash;
%hash<a> = ($hashref);
is +%hash, 1, '%hash<a> = ($hashref) does not flatten the hashref';
}
{
my $hashref = {:a(1), :b(2), :c(3)};
my %hash;
%hash<a> = $hashref;
is +%hash, 1, '%hash<a> = $hashref does not flatten the hashref';
}