diff options
author | Ben Morrow <ben@morrow.me.uk> | 2009-01-18 07:49:25 +0000 |
---|---|---|
committer | Ben Morrow <ben@morrow.me.uk> | 2009-03-25 21:14:02 +0000 |
commit | d89f1457dd9f98842e5ed9303abe624d37e3be49 (patch) | |
tree | 53a2b26a41a5fbbaf2019976b1d3f23cb69f0250 /t/op/filetest.t | |
parent | 9846fe22082511d6e91ccc4153eb9b5fdfd4996b (diff) | |
download | perl-d89f1457dd9f98842e5ed9303abe624d37e3be49.tar.gz |
Tests for -X overloading.
Diffstat (limited to 't/op/filetest.t')
-rwxr-xr-x | t/op/filetest.t | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/t/op/filetest.t b/t/op/filetest.t index c73d747ba7..7173c90384 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"); +} |