--- trunk/t/1_nos.t 2005/05/17 11:09:08 33 +++ trunk/t/1_nos.t 2005/05/17 19:15:27 37 @@ -3,25 +3,30 @@ use strict; use blib; -use Test::More tests => 23; +use Test::More tests => 31; BEGIN { use_ok('Nos') }; ok(my $nos = new Nos('dsn' => 'dbi:Pg:dbname=notices'), "new"); ok($nos->new_list( list => 'My list', email => 'my-list@example.com'), "new_list my-list"); -ok($nos->new_list( list => 'My list', email => 'my2@example.com'), "new_list my2"); +ok($nos->new_list( list => 'another', email => 'another@example.com'), "new_list another"); +ok($nos->new_list( list => 'test', email => 'test@example.com'), "new_list test"); -ok($nos->_add_list( list => 'Another list', email => 'list2@example.com'), "_add_list"); -ok($nos->_get_list('Another list'), "_get_list"); +ok($nos->_get_list('My list'), "_get_list"); +ok($nos->_get_list('another'), "_get_list"); +ok($nos->_get_list('test'), "_get_list"); +my $i = 0; foreach my $email (qw(foo@example.com bar@example.com baz@example.com)) { ok($nos->add_member_to_list( list => 'My list', email => $email ), "add_member_to_list $email"); - ok($nos->add_member_to_list( list => 'Another list', email => $email ), "add_member_to_list $email"); + ok($nos->add_member_to_list( list => 'another', email => $email ), "add_member_to_list $email") if ($i % 2 == 0); + ok($nos->add_member_to_list( list => 'test', email => $email ), "add_member_to_list $email") if ($i % 3 == 0); } -ok($nos->add_message_to_list( list => 'My list', message => "Subject: test\nJust a test" ), "add_message_to_list"); +ok($nos->add_message_to_list( list => 'My list', message => "Subject: test\n\nJust a test\n\n" ), "add_message_to_list"); foreach my $i ( 1 .. 10 ) { - ok($nos->add_message_to_list( list => 'Another list', message => "Subject: test $i" ), "add_message_to_list"); + ok($nos->add_message_to_list( list => 'another', message => "Subject: test $i" ), "add_message_to_list"); + ok($nos->add_message_to_list( list => 'test', message => "Subject: test e-mail $i\n\nisn't life great?" ), "add_message_to_list") if ($i % 3 == 0); }