This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Subject: unicode_strings.t: Imprv test output
[perl5.git] / lib / overload.t
index da580ca..ef65ea5 100644 (file)
@@ -47,7 +47,8 @@ sub numify { 0 + "${$_[0]}" } # Not needed, additional overhead
 package main;
 
 $| = 1;
-use Test::More tests => 4880;
+BEGIN { require './test.pl' }
+plan tests => 4882;
 
 use Scalar::Util qw(tainted);
 
@@ -1990,4 +1991,20 @@ foreach my $op (qw(<=> == != < <= > >=)) {
     }
 }
 
+# Test overload from the main package
+fresh_perl_is
+ '$^W = 1; use overload q\""\ => sub {"ning"}; print bless []',
+ 'ning',
+  { switches => ['-wl'], stderr => 1 },
+ 'use overload from the main package'
+;
+
+{
+    package blessed_methods;
+    use overload '+' => sub {};
+    bless overload::Method __PACKAGE__,'+';
+    eval { overload::Method __PACKAGE__,'+' };
+    ::is($@, '', 'overload::Method and blessed overload methods');
+}
+
 # EOF