This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Convert Data::Dumper's overload.t to Test::More
authorNicholas Clark <nick@ccl4.org>
Mon, 24 Jan 2011 16:51:49 +0000 (16:51 +0000)
committerNicholas Clark <nick@ccl4.org>
Tue, 25 Jan 2011 09:31:09 +0000 (09:31 +0000)
dist/Data-Dumper/t/overload.t

index 9bb3410..3ccd2a9 100644 (file)
@@ -11,9 +11,10 @@ BEGIN {
     }
 }
 
+use strict;
 use Data::Dumper;
 
-print "1..1\n";
+use Test::More tests => 4;
 
 package Foo;
 use overload '""' => 'as_string';
@@ -25,12 +26,11 @@ package main;
 
 my $f = Foo->new;
 
-print "#\$f=$f\n";
+isa_ok($f, 'Foo');
+is("$f", '%%%%', 'String overloading works');
 
-$_ = Dumper($f);
-s/^/#/mg;
-print $_;
+my $d = Dumper($f);
 
-print "not " unless /bar/ && /Foo/;
-print "ok 1\n";
+like($d, qr/bar/);
+like($d, qr/Foo/);