From: Ben Morrow Date: Sun, 18 Jan 2009 07:49:25 +0000 (+0000) Subject: Tests for -X overloading. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d89f1457dd9f98842e5ed9303abe624d37e3be49;p=p5sagit%2Fp5-mst-13.2.git Tests for -X overloading. --- diff --git a/t/op/filetest.t b/t/op/filetest.t index c73d747..7173c90 100755 --- a/t/op/filetest.t +++ b/t/op/filetest.t @@ -95,3 +95,18 @@ unlink $tempfile; ok( -f _ ); sub _ { "this is not a file name" } ok( -f _ ); + +my $over; +{ + package OverFtest; + + use overload -X => sub { $over = \@_; "-$_[1]"; }; +} + +my $o = bless [], "OverFtest"; +for my $op (split //, "rwxoRWXOezsfdlpSbctugkTMBAC") { + ok( my $rv = eval "-$op \$o", "overloaded -$op succeeds" ); + is( $over->[0], $o, "correct object for overloaded -$op" ); + is( $over->[1], $op, "correct op for overloaded -$op" ); + is( $rv, "-$op", "correct return value for overloaded -$op"); +}