From: Peter Rabbitson Date: Wed, 21 Oct 2009 14:33:45 +0000 (+0000) Subject: Show what's wrong with the current populate code X-Git-Tag: v0.08113~30 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c0d8cb1fa36945ace1bb09bba48a5e9ee60ddc6e;p=dbsrgits%2FDBIx-Class.git Show what's wrong with the current populate code --- diff --git a/t/100populate.t b/t/100populate.t index 9e7bc88..994524e 100644 --- a/t/100populate.t +++ b/t/100populate.t @@ -5,6 +5,7 @@ use Test::More; use Test::Exception; use lib qw(t/lib); use DBICTest; +use Path::Class::File (); my $schema = DBICTest->init_schema(); @@ -218,4 +219,43 @@ throws_ok { ]); } qr/inconsistent/, 'literal sql must be the same in all slices'; +# the stringification has nothing to do with the artist name +# this is solely for testing consistency +my $fn = Path::Class::File->new ('somedir/somefilename.tmp'); +my $fn2 = Path::Class::File->new ('somedir/someotherfilename.tmp'); + +lives_ok { + $rs->populate([ + { + name => 'supplied before stringifying object', + }, + { + name => $fn, + } + ]); +} 'stringifying objects pass through'; + +# ... and vice-versa. + +lives_ok { + $rs->populate([ + { + name => $fn2, + }, + { + name => 'supplied after stringifying object', + }, + ]); +} 'stringifying objects pass through'; + +for ( + $fn, + $fn2, + 'supplied after stringifying object', + 'supplied before stringifying object' +) { + my $row = $rs->find ({name => $_}); + ok ($row, "Stringification test row '$_' properly inserted"); +} + done_testing;