Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add tests for RT #120662
  • Loading branch information
Mouq committed Mar 11, 2015
1 parent 1d6747d commit 966d85b
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion S03-metaops/hyper.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 280;
plan 301;

=begin pod
Expand Down Expand Up @@ -819,6 +819,45 @@ is ((1, 2) >>[+]<< (100, 200)).join(','), '101,202',
# RT #123178
{
is 42 «~~« (Array, List, Parcel), (False, False, False), "hyper against an undefined Iterable doesn't hang";
is 42 «~~« (Hash, Bag, Enum), (False, False, False), "hyper against an undefined Associative doesn't hang";
}

# RT #120662
{
# <empty list> <hyper> <empty list>
is () »+« (), (), "no-dwim hyper between empty lists doesn't hang";
is () «+« (), (), "left-dwim hyper between empty lists doesn't hang";
is () »+» (), (), "right-dwim hyper between empty lists doesn't hang";
is () «+» (), (), "both-dwim hyper between empty lists doesn't hang";
# <item> <hyper> <empty list>
is True «+« (), (), "left-dwim hyper against empty RHS doesn't hang";
is True »+» (), (), "right-dwim hyper against empty RHS doesn't hang";
is True «+» (), (), "both-dwim hyper against empty RHS doesn't hang";
throws_like {True »+« ()}, X::HyperOp::NonDWIM,
left-elems => 1, right-elems => 0,
"non-dwim hyper against empty RHS dies";
# <empty list> <hyper> <item>
is () «+« True, (), "left-dwim hyper against empty LHS doesn't hang";
is () «+» True, (), "right-dwim hyper against empty LHS doesn't hang";
is () «+» True, (), "both-dwim hyper against empty LHS doesn't hang";
throws_like {() »+« True}, X::HyperOp::NonDWIM,
left-elems => 0, right-elems => 1,
"non-dwim hyper against empty RHS dies";
my @a = «"Furthermore, Subhuti," "the basic nature" "of the five" "aggregates" "is emptiness."»;
# <list> <hyper> <empty list>
is @a «+« (), (), "left-dwim hyper against empty RHS doesn't hang";
is @a »+» (), (), "right-dwim hyper against empty RHS doesn't hang";
is @a «+» (), (), "both-dwim hyper against empty RHS doesn't hang";
throws_like {@a »+« ()}, X::HyperOp::NonDWIM,
left-elems => 5, right-elems => 0,
"non-dwim hyper against empty RHS dies";
# <empty list> <hyper> <list>
is () «+« @a, (), "left-dwim hyper against empty LHS doesn't hang";
is () »+» @a, (), "right-dwim hyper against empty LHS doesn't hang";
is () «+» @a, (), "both-dwim hyper against empty LHS doesn't hang";
throws_like {() »+« @a}, X::HyperOp::NonDWIM,
left-elems => 0, right-elems => 5,
"non-dwim hyper against empty RHS dies";
}

done;
Expand Down

0 comments on commit 966d85b

Please sign in to comment.