move to Email::MIME, clean up test to use cmp_ok
[p5sagit/Email-Archive.git] / t / email-archive.t
similarity index 59%
rename from test_run
rename to t/email-archive.t
index a8b52ad..8f959f5 100644 (file)
--- a/test_run
@@ -1,12 +1,13 @@
 #!/usr/bin/perl
 use strict;
 use warnings;
-use Email::Simple;
-use Email::Simple::Creator;
+use Email::MIME;
+
+use Test::More;
 
 use Email::Archive;
 
-my $email = Email::Simple->create(
+my $email = Email::MIME->create(
     header => [
       From    => 'foo@example.com',
       To      => 'drain@example.com',
@@ -17,9 +18,12 @@ my $email = Email::Simple->create(
 );
 
 my $e = Email::Archive->new();
-$e->connect('dbi:SQLite:dbname=test.db');
-print "sending @{[$email->as_string]}\n";
+$e->connect('dbi:SQLite:dbname=t/test.db');
 $e->store($email);
 
 my $found = $e->retrieve('helloworld');
-print $found->as_string;
+cmp_ok($found->header('subject'), 'eq', "Message in a bottle",
+  "can find stored message by ID");
+
+done_testing;
+unlink 't/test.db';