remove extraneous garbage from tests
[gitmo/Class-C3.git] / t / 21_C3_with_overload.t
index e612568..136eefd 100644 (file)
@@ -5,10 +5,6 @@ use warnings;
 
 use Test::More tests => 8;
 
-BEGIN {
-    use_ok('Class::C3');
-}
-
 {
     package BaseTest;
     use strict;
@@ -30,8 +26,24 @@ BEGIN {
     use warnings;
     use base 'OverloadingTest';
     use Class::C3;
+
+    package BaseTwo;
+    use overload (
+        q{fallback} => 1,
+        q{""}       => 'str', ### character
+    );
+    sub str {
+        return 'BaseTwo str';
+    }
+
+    package OverloadInheritTwo;
+    use Class::C3;
+    use base qw/BaseTwo/;
+
 }
 
+Class::C3::initialize();
+
 my $x = InheritingFromOverloadedTest->new();
 isa_ok($x, 'InheritingFromOverloadedTest');
 
@@ -50,5 +62,10 @@ eval {
 ok(!$@, '... this should not throw an exception');
 ok($result, '... and we should get the true value');
 
+eval {
+    my $obj = bless {}, 'OverloadInheritTwo';
+};
+is($@, '', "Overloading to method name string");
+
 #use Data::Dumper;
 #diag Dumper { Class::C3::_dump_MRO_table }