Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
s/Parcel/List/g to reappropriate Parcel's tests for List
Parcel is gone, List took its place. There may be a couple usefull tests still
in S02-types/parcel.t, so just change it into a list.t
  • Loading branch information
niner committed Aug 22, 2015
1 parent b0a61c7 commit df22323
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions S02-types/parcel.t → S02-types/list.t
Expand Up @@ -3,42 +3,42 @@ use Test;

plan 54;

isa-ok (5, 7, 8), Parcel, '(5, 7, 8) is Parcel';
is +(5, 7, 8), 3, 'prefix:<+> on a Parcel';
is ~(5, 7, 8), '5 7 8', 'prefix:<~> on a Parcel';
is (5, 7, 8).Str, '5 7 8', '.Str on a Parcel';
isa-ok (5, 7, 8), List, '(5, 7, 8) is List';
is +(5, 7, 8), 3, 'prefix:<+> on a List';
is ~(5, 7, 8), '5 7 8', 'prefix:<~> on a List';
is (5, 7, 8).Str, '5 7 8', '.Str on a List';

# .perl
is ().perl, '()', '.perl on empty Parcel';
#?niecza todo '.item.perl on empty Parcel gives Match.ast shorthand'
is ().item.perl, '$( )', '.item.perl on empty Parcel';
is ().perl, '()', '.perl on empty List';
#?niecza todo '.item.perl on empty List gives Match.ast shorthand'
is ().item.perl, '$()', '.item.perl on empty List';

# L<S02/Quoting forms/Elsewhere it is equivalent to a parenthesized list of strings>

isa-ok <5 7 8>, Parcel, '<5 7 8> is Parcel';
is +<5 7 8>, 3, 'prefix:<+> on an angle bracket Parcel';
is ~<5 7 8>, '5 7 8', 'prefix:<~> on an angle bracket Parcel';
is <5 7 8>.Str, '5 7 8', '.Str on an angle bracket Parcel';
isa-ok <5 7 8>, List, '<5 7 8> is List';
is +<5 7 8>, 3, 'prefix:<+> on an angle bracket List';
is ~<5 7 8>, '5 7 8', 'prefix:<~> on an angle bracket List';
is <5 7 8>.Str, '5 7 8', '.Str on an angle bracket List';

#?niecza 3 skip ".Parcel NYI"
isa-ok (5, 7, 8).Parcel, Parcel, '.Parcel returns an parcel';
is (5, 7, 8).Parcel, [5,7,8], '.Parcel contains the right items';
is (5, 7, 8).Parcel.elems, 3, '.Parcel contains the right number of elements';
#?niecza 3 skip ".List NYI"
isa-ok (5, 7, 8).List, List, '.List returns an parcel';
is (5, 7, 8).List, [5,7,8], '.List contains the right items';
is (5, 7, 8).List.elems, 3, '.List contains the right number of elements';

is ?(), False, 'empty Parcel is False';
is ?(1,2,3), True, 'non-empty Parcel is True';
is ?(), False, 'empty List is False';
is ?(1,2,3), True, 'non-empty List is True';

lives-ok { <5 7 8>[] }, 'can zen slice a Parcel';
lives-ok { <5 7 8>[] }, 'can zen slice a List';

# WAS: RT #115282, modified for lolly brannch
is $(;).elems, 0, '$(;) parses, and is empty';

# .rotate
{
my $p = <a b c d e>;
is ~$p.rotate, 'b c d e a', 'Parcel.rotate defaults to +1';
is ~$p.rotate, 'b c d e a', 'List.rotate defaults to +1';
is ~$p, 'a b c d e', 'original parcel unmodified';
ok $p.rotate ~~ Parcel, 'Parcel.rotate returns a Parcel';
ok $p.rotate ~~ List, 'List.rotate returns a List';

is ~$p.rotate(2), 'c d e a b', '.rotate(2)';
is ~$p, 'a b c d e', 'original parcel still unmodified';
Expand Down Expand Up @@ -80,7 +80,7 @@ is $(;).elems, 0, '$(;) parses, and is empty';
is ~$p, 'a b c d e', 'original still unmodified (negative)';
} #13

# RT125677 Make sure Parcel.rotate is Cool with stuff
# RT125677 Make sure List.rotate is Cool with stuff
{
my $p = <a b c d e>;
is ~$p.rotate('2'), 'c d e a b', '.rotate("2")';
Expand All @@ -95,11 +95,11 @@ is $(;).elems, 0, '$(;) parses, and is empty';
} #4

{
my $p = Parcel.new( <a b c> );
my $p = List.new( <a b c> );
is $p.elems, 1, 'did we get the list';
is $p, <a b c>, 'did we get what we put in';

$p = Parcel.new( 'a','b','c' );
$p = List.new( 'a','b','c' );
is $p.elems, 3, 'did we get the parameters';
is $p, <a b c>, 'did we get what we put in';
} #4
Expand Down

0 comments on commit df22323

Please sign in to comment.