Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove bogus \ tests from 2008
The \ in the tests were really used in the sense they exist in Perl 5.
  • Loading branch information
lizmat committed Jul 5, 2015
1 parent 75119ec commit 038ad11
Showing 1 changed file with 5 additions and 111 deletions.
116 changes: 5 additions & 111 deletions S02-literals/autoref.t
Expand Up @@ -7,16 +7,16 @@ use Test;
Tests testing that automatical referentiation (e.g. $arrayref = @array)
works. To be more detailled, things tested are:
* Implicit & explicit referentiation of arrays & hashes in assignment
* Implicit & explicit referentiation of arrays & hashes in assignment to an
* Implicit referentiation of arrays & hashes in assignment
* Implicit referentiation of arrays & hashes in assignment to an
array & hash element
* Implicit & explicit referentiation of array&hashes&array literals&arrayref
* Implicit referentiation of array&hashes&array literals&arrayref
literals&hashref literals in pair creation with key => ... and :key(...)
and ... => key.
=end description

plan 59;
plan 38;

# Implicit referentiation of arrays in assignment
{
Expand All @@ -27,17 +27,6 @@ plan 59;
is +$ref, 3, '$arrayref = @array works (2)';
}

{
my @array = <a b c>;
my $ref = \@array;

#?niecza todo
is ~$ref, "a b c", '$arrayref = \@array works (1)';
# Explicit referentiation of arrays in assignment
#?niecza skip 'Cannot use value like Capture as a Number'
is +$ref, 1, '$arrayref = \@array works (2)';
}

# Implicit referentiation of hashes in assignment
{
my %hash = (a => 1, b => 2, c => 3);
Expand All @@ -47,15 +36,6 @@ plan 59;
is +$ref.values, 3, '$hashref = %hash works (2)';
}

# Explicit referentiation of hashes in assignment
{
my %hash = (a => 1, b => 2, c => 3);
my $ref = \%hash;

is ~$ref[0].values.sort, "1 2 3", '$hashref = \%hash works (1)';
is +$ref[0].values, 3, '$hashref = \%hash works (2)';
}

# Implicit referentiation of arrays in assignment to an array element
{
my @array = <a b c>;
Expand All @@ -67,19 +47,6 @@ plan 59;
is +@other[1], 3, '@other[$idx] = @array works (3)';
}

# Explicit referentiation of arrays in assignment to an array element
{
my @array = <a b c>;
my @other;
@other[1] = \@array;

#?niecza todo
is ~@other, " a b c", '@other[$idx] = \@array works (1)';
is +@other, 2, '@other[$idx] = \@array works (2)';
#?niecza skip 'Cannot use value like Capture as a Number'
is +@other[1], 1, '@other[$idx] = \@array works (3)';
}

# Implicit referentiation of hashes in assignment to an array element
{
my %hash = (a => 1, b => 2, c => 3);
Expand All @@ -90,17 +57,6 @@ plan 59;
is +@other[1], 3, '@other[$idx] = %hash works (2)';
}

# Explicit referentiation of hashes in assignment to an array element
{
my %hash = (a => 1, b => 2, c => 3);
my @other;
@other[1] = \%hash;

is +@other, 2, '@other[$idx] = \%hash works (1)';
#?niecza skip 'Cannot use value like Capture as a Number'
is +@other[1], 1, '@other[$idx] = \%hash works (2)';
}

# Implicit referentiation of arrays in assignment to a hash element
{
my @array = <a b c>;
Expand All @@ -111,17 +67,6 @@ plan 59;
is +%other<a>, 3, '%other[$key] = @array works (2)';
}

# Explicit referentiation of arrays in assignment to a hash element
{
my @array = <a b c>;
my %other;
%other<a> = \@array;

is +%other, 1, '%other[$key] = \@array works (1)';
#?niecza skip 'Cannot use value like Capture as a Number'
is +%other<a>, 1, '%other[$key] = \@array works (2)';
}

# Implicit referentiation of hashes in assignment to a hash element
{
my %hash = (a => 1, b => 2, c => 3);
Expand All @@ -132,17 +77,6 @@ plan 59;
is +%other<a>, 3, '%other[$key] = %hash works (2)';
}

# Explicit referentiation of hashes in assignment to a hash element
{
my %hash = (a => 1, b => 2, c => 3);
my %other;
%other<a> = \%hash;

is +%other, 1, '%other[$key] = \%hash works (1)';
#?niecza skip 'Cannot use value like Capture as a Number'
is +%other<a>, 1, '%other[$key] = \%hash works (2)';
}

# Implicit referentiation of arrays in pair creation with key => ...
{
my @array = <a b c>;
Expand All @@ -152,17 +86,6 @@ plan 59;
is +$pair.value, 3, '(key => @array) works (2)';
}

# Explicit referentiation of arrays in pair creation with key => ...
{
my @array = <a b c>;
my $pair = (key => \@array);

#?niecza todo
is ~$pair.value, "a b c", '(key => \@array) works (1)';
#?niecza skip 'Cannot use value like Capture as a Number'
is +$pair.value, 1, '(key => \@array) works (2)';
}

# Implicit referentiation of hashes in pair creation with key => ...
{
my %hash = (a => 1, b => 2, c => 3);
Expand All @@ -172,15 +95,6 @@ plan 59;
is +$pair.value.values, 3, '(key => %hash) works (2)';
}

# Explicit referentiation of hashes in pair creation with key => ...
{
my %hash = (a => 1, b => 2, c => 3);
my $pair = (key => \%hash);

is ~$pair.value.[0].values.sort, "1 2 3", '(key => \%hash) works (1)';
is +$pair.value.[0].values, 3, '(key => \%hash) works (2)';
}

# Implicit referentiation of arrays in pair creation with :key(...)
{
my @array = <a b c>;
Expand All @@ -190,17 +104,6 @@ plan 59;
is +$pair.value, 3, '(:key(@array)) works (2)';
}

# Explicit referentiation of arrays in pair creation with :key(...)
{
my @array = <a b c>;
my $pair = (:key(\@array));

#?niecza todo
is ~$pair.value, "a b c", '(:key(\@array)) works (1)';
#?niecza skip 'Cannot use value like Capture as a Number'
is +$pair.value, 1, '(:key(\@array)) works (2)';
}

# Implicit referentiation of hashes in pair creation with :key(...)
{
my %hash = (a => 1, b => 2, c => 3);
Expand All @@ -210,15 +113,6 @@ plan 59;
is +$pair.value.values, 3, '(:key(%hash)) works (2)';
}

# Explicit referentiation of hashes in pair creation with :key(...)
{
my %hash = (a => 1, b => 2, c => 3);
my $pair = (:key(\%hash));

is ~$pair.value.[0].values.sort, "1 2 3", '(:key(\%hash)) works (1)';
is +$pair.value.[0].values, 3, '(:key(\%hash)) works (2)';
}

# Implicit referentiation of array literals in pair creation with key => ...
{
my $pair = (key => <a b c>);
Expand Down Expand Up @@ -293,7 +187,7 @@ plan 59;
lives-ok { my $a = (\my %h)<a> },
'no Null PMC access when hash indexing a hash ref';
my %h = ( 'a' => 1, 'b' => 2 );
my $h_ref = \%h;
my $h_ref = %h;
lives-ok { my $b = $h_ref.{"a"} },
'no Null PMC access when trying to hash index a Capture';
}
Expand Down

0 comments on commit 038ad11

Please sign in to comment.