rename test to make room for further testing. also remove insert_sql.txt. Was this...
[p5sagit/Email-Archive.git] / t / basic.t
diff --git a/t/basic.t b/t/basic.t
new file mode 100644 (file)
index 0000000..8f959f5
--- /dev/null
+++ b/t/basic.t
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Email::MIME;
+
+use Test::More;
+
+use Email::Archive;
+
+my $email = Email::MIME->create(
+    header => [
+      From    => 'foo@example.com',
+      To      => 'drain@example.com',
+      Subject => 'Message in a bottle',
+      'Message-ID' => 'helloworld',
+    ],
+    body => 'hello there!'
+);
+
+my $e = Email::Archive->new();
+$e->connect('dbi:SQLite:dbname=t/test.db');
+$e->store($email);
+
+my $found = $e->retrieve('helloworld');
+cmp_ok($found->header('subject'), 'eq', "Message in a bottle",
+  "can find stored message by ID");
+
+done_testing;
+unlink 't/test.db';