]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/lei_mail_sync.t
t/run.perl: fix "make check-run" on FreeBSD 11.x
[public-inbox.git] / t / lei_mail_sync.t
index 864d6e48f48d4dafefaf7dab94e39ab899c8f864..a5e5f5d30a0062b03cbe5b508914b889469a10a8 100644 (file)
@@ -24,7 +24,7 @@ is_deeply([$ro->folders($imap)], [$imap], 'IMAP folder with full GLOB');
 is_deeply([$ro->folders('imaps://bob@[::1]/INBOX')], [$imap],
                'IMAP folder with partial GLOB');
 
-is_deeply($ro->locations_for('deadbeef'),
+is_deeply($ro->locations_for("\xde\xad\xbe\xef"),
        { $imap => [ 1 ] }, 'locations_for w/ imap');
 
 my $maildir = 'maildir:/home/user/md';
@@ -33,10 +33,22 @@ $lms->lms_begin;
 ok($lms->set_src('deadbeef', $maildir, \$fname), 'set Maildir once');
 ok($lms->set_src('deadbeef', $maildir, \$fname) == 0, 'set Maildir again');
 $lms->lms_commit;
-is_deeply($ro->locations_for('deadbeef'),
+is_deeply($ro->locations_for("\xde\xad\xbe\xef"),
        { $imap => [ 1 ], $maildir => [ $fname ] },
        'locations_for w/ maildir + imap');
 
+if ('mess things up pretend old bug') {
+       $lms->lms_begin;
+       $lms->{dbh}->do('UPDATE folders SET loc = ? WHERE loc = ?', undef,
+                       "$maildir/", $maildir);
+       ok(delete $lms->{fmap}, 'clear folder map');
+       $lms->lms_commit;
+
+       $lms->lms_begin;
+       ok($lms->set_src('deadbeef', $maildir, \$fname), 'set Maildir once');
+       $lms->lms_commit;
+};
+
 is_deeply([sort($ro->folders)], [$imap, $maildir], 'both folders shown');
 my @res;
 $ro->each_src($maildir, sub {