unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: "Eric Wong (Contractor, The Linux Foundation)" <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 3/5] t/over: test empty Subject: line matching
Date: Mon,  2 Apr 2018 00:04:54 +0000	[thread overview]
Message-ID: <20180402000456.13446-4-e@80x24.org> (raw)
In-Reply-To: <20180402000456.13446-1-e@80x24.org>

We need to ensure we don't match NULL 'sid' columns in the
`over' table.
---
 t/over.t | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/t/over.t b/t/over.t
index 1d3f9b3..bfe331e 100644
--- a/t/over.t
+++ b/t/over.t
@@ -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();
-- 
EW


  parent reply	other threads:[~2018-04-02  0:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-02  0:04 [PATCH 0/5] v2: drop Xapian skeleton for SQLite overview DB Eric Wong (Contractor, The Linux Foundation)
2018-04-02  0:04 ` [PATCH 1/5] replace Xapian skeleton with " Eric Wong (Contractor, The Linux Foundation)
2018-04-05  8:59   ` Eric Wong
2018-04-02  0:04 ` [PATCH 2/5] v2writable: simplify barrier vs checkpoints Eric Wong (Contractor, The Linux Foundation)
2018-04-02  0:04 ` Eric Wong (Contractor, The Linux Foundation) [this message]
2018-04-02  0:04 ` [PATCH 4/5] www: rework query responses to avoid COUNT in SQLite Eric Wong (Contractor, The Linux Foundation)
2018-04-02  0:04 ` [PATCH 5/5] over: speedup get_thread by avoiding JOIN Eric Wong (Contractor, The Linux Foundation)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180402000456.13446-4-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).