Permalink
Browse files

fix reverse method

  • Loading branch information...
1 parent 5b44784 commit c1c3aa1412b021a53af80be001f939b994086442 Hakim Cassimally committed May 30, 2011
@@ -18,8 +18,8 @@ sub reverse {
my $self = shift;
return $self->new({
%$self,
- left => $self->right,
- right => $self->left,
+ left => $self->right->reverse,
+ right => $self->left->reverse,
});
}
sub mk_node {
@@ -54,6 +54,9 @@ sub test_match {
test_match( $node, 0, e(d,f), 'e(d,f)' );
my ($e, $f, $d) =
test_match( $node, 1, e(f,d), 'e(f,d)' );
+test_match( $node, 1, e(f,any), 'e(f,any)' );
+
+test_match( $node, 1, e(any,f)->reverse, 'e(any,f)->reverse' );
test_match( $node, 1, e(d,f)->reverse, 'e(d,f)->reverse' );
test_match( $node, 1, e(undef,d), 'e(undef,d)' );
test_match( $node, 1, e(f,undef), 'e(f,undef)' );

0 comments on commit c1c3aa1

Please sign in to comment.