diff options
author | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-04-02 00:04:54 +0000 |
---|---|---|
committer | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-04-02 00:05:41 +0000 |
commit | 3cc5ff405d9054fbf47ac44774fca4f9a72ff65a (patch) | |
tree | 0485f6b85e212ca7e748271faa1a5d4e3ef0f7e1 | |
parent | 87425172fb480214c3f72e0174f4f8f15f48d92d (diff) | |
download | public-inbox-3cc5ff405d9054fbf47ac44774fca4f9a72ff65a.tar.gz |
We need to ensure we don't match NULL 'sid' columns in the `over' table.
-rw-r--r-- | t/over.t | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -4,6 +4,7 @@ use strict; use warnings; use Test::More; use File::Temp qw/tempdir/; +use Compress::Zlib qw(compress); foreach my $mod (qw(DBD::SQLite)) { eval "require $mod"; plan skip_all => "$mod missing for over.t" if $@; @@ -35,4 +36,28 @@ is(int($x), $x, 'integer tid for ghost'); $y = $over->create_ghost('NEVAR'); is($y, $x + 1, 'integer tid for ghost increases'); +my $ddd = compress(''); +foreach my $s ('', undef) { + $over->add_over([0, 98, [ 'a' ], [], $s, $ddd]); + $over->add_over([0, 99, [ 'b' ], [], $s, $ddd]); + my $msgs = [ map { $_->{num} } @{$over->get_thread('a')->{msgs}} ]; + is_deeply([98], $msgs, + 'messages not linked by empty subject'); +} + +$over->add_over([0, 98, [ 'a' ], [], 's', $ddd]); +$over->add_over([0, 99, [ 'b' ], [], 's', $ddd]); +foreach my $mid (qw(a b)) { + my $msgs = [ map { $_->{num} } @{$over->get_thread('a')->{msgs}} ]; + is_deeply([98, 99], $msgs, 'linked messages by subject'); +} +$over->add_over([0, 98, [ 'a' ], [], 's', $ddd]); +$over->add_over([0, 99, [ 'b' ], ['a'], 'diff', $ddd]); +foreach my $mid (qw(a b)) { + my $msgs = [ map { $_->{num} } @{$over->get_thread($mid)->{msgs}} ]; + is_deeply([98, 99], $msgs, "linked messages by Message-ID: <$mid>"); +} + +$over->rollback_lazy; + done_testing(); |