user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 4/5] t/lei_store: rename $lst to $sto
Date: Thu, 25 Feb 2021 22:41:40 -1100	[thread overview]
Message-ID: <20210226094141.11514-5-e@80x24.org> (raw)
In-Reply-To: <20210226094141.11514-1-e@80x24.org>

`$sto' is prevalent throughout the rest of the lei code,
and `$lst' seems like an abbreviation for "list".

I don't like the noise from commits like this, but I hope the
long-term payoff being less confusing to new developers is worth
it...
---
 t/lei_store.t | 102 +++++++++++++++++++++++++-------------------------
 1 file changed, 51 insertions(+), 51 deletions(-)

diff --git a/t/lei_store.t b/t/lei_store.t
index c9360f8f..e93fe779 100644
--- a/t/lei_store.t
+++ b/t/lei_store.t
@@ -11,32 +11,32 @@ require_ok 'PublicInbox::LeiStore';
 require_ok 'PublicInbox::ExtSearch';
 my ($home, $for_destroy) = tmpdir();
 my $opt = { 1 => \(my $out = ''), 2 => \(my $err = '') };
-my $store_dir = "$home/lst";
+my $store_dir = "$home/sto";
 local $ENV{GIT_COMMITTER_EMAIL} = 'lei@example.com';
 local $ENV{GIT_COMMITTER_NAME} = 'lei user';
-my $lst = PublicInbox::LeiStore->new($store_dir, { creat => 1 });
-ok($lst, '->new');
-my $smsg = $lst->add_eml(eml_load('t/data/0001.patch'));
+my $sto = PublicInbox::LeiStore->new($store_dir, { creat => 1 });
+ok($sto, '->new');
+my $smsg = $sto->add_eml(eml_load('t/data/0001.patch'));
 like($smsg->{blob}, qr/\A[0-9a-f]+\z/, 'add returned OID');
 my $eml = eml_load('t/data/0001.patch');
-is($lst->add_eml($eml), undef, 'idempotent');
-$lst->done;
-is_deeply([$lst->mbox_keywords($eml)], [], 'no keywords');
+is($sto->add_eml($eml), undef, 'idempotent');
+$sto->done;
+is_deeply([$sto->mbox_keywords($eml)], [], 'no keywords');
 $eml->header_set('Status', 'RO');
-is_deeply([$lst->mbox_keywords($eml)], ['seen'], 'seen extracted');
+is_deeply([$sto->mbox_keywords($eml)], ['seen'], 'seen extracted');
 $eml->header_set('X-Status', 'A');
-is_deeply([$lst->mbox_keywords($eml)], [qw(answered seen)],
+is_deeply([$sto->mbox_keywords($eml)], [qw(answered seen)],
 	'seen+answered extracted');
 $eml->header_set($_) for qw(Status X-Status);
 
-is_deeply([$lst->maildir_keywords('/foo:2,')], [], 'Maildir no keywords');
-is_deeply([$lst->maildir_keywords('/foo:2,S')], ['seen'], 'Maildir seen');
-is_deeply([$lst->maildir_keywords('/foo:2,RS')], ['answered', 'seen'],
+is_deeply([$sto->maildir_keywords('/foo:2,')], [], 'Maildir no keywords');
+is_deeply([$sto->maildir_keywords('/foo:2,S')], ['seen'], 'Maildir seen');
+is_deeply([$sto->maildir_keywords('/foo:2,RS')], ['answered', 'seen'],
 	'Maildir answered + seen');
-is_deeply([$lst->maildir_keywords('/foo:2,RSZ')], ['answered', 'seen'],
+is_deeply([$sto->maildir_keywords('/foo:2,RSZ')], ['answered', 'seen'],
 	'Maildir answered + seen w/o Z');
 {
-	my $es = $lst->search;
+	my $es = $sto->search;
 	my $msgs = $es->over->query_xover(0, 1000);
 	is(scalar(@$msgs), 1, 'one message');
 	is($msgs->[0]->{blob}, $smsg->{blob}, 'blob matches');
@@ -49,82 +49,82 @@ is_deeply([$lst->maildir_keywords('/foo:2,RSZ')], ['answered', 'seen'],
 }
 
 for my $parallel (0, 1) {
-	$lst->{priv_eidx}->{parallel} = $parallel;
-	my $docids = $lst->set_eml_keywords($eml, qw(seen draft));
+	$sto->{priv_eidx}->{parallel} = $parallel;
+	my $docids = $sto->set_eml_keywords($eml, qw(seen draft));
 	is(scalar @$docids, 1, 'set keywords on one doc');
-	$lst->done;
-	my @kw = $lst->search->msg_keywords($docids->[0]);
+	$sto->done;
+	my @kw = $sto->search->msg_keywords($docids->[0]);
 	is_deeply(\@kw, [qw(draft seen)], 'kw matches');
 
-	$docids = $lst->add_eml_keywords($eml, qw(seen draft));
-	$lst->done;
+	$docids = $sto->add_eml_keywords($eml, qw(seen draft));
+	$sto->done;
 	is(scalar @$docids, 1, 'idempotently added keywords to doc');
-	@kw = $lst->search->msg_keywords($docids->[0]);
+	@kw = $sto->search->msg_keywords($docids->[0]);
 	is_deeply(\@kw, [qw(draft seen)], 'kw matches after noop');
 
-	$docids = $lst->remove_eml_keywords($eml, qw(seen draft));
+	$docids = $sto->remove_eml_keywords($eml, qw(seen draft));
 	is(scalar @$docids, 1, 'removed from one doc');
-	$lst->done;
-	@kw = $lst->search->msg_keywords($docids->[0]);
+	$sto->done;
+	@kw = $sto->search->msg_keywords($docids->[0]);
 	is_deeply(\@kw, [], 'kw matches after remove');
 
-	$docids = $lst->remove_eml_keywords($eml, qw(answered));
+	$docids = $sto->remove_eml_keywords($eml, qw(answered));
 	is(scalar @$docids, 1, 'removed from one doc (idempotently)');
-	$lst->done;
-	@kw = $lst->search->msg_keywords($docids->[0]);
+	$sto->done;
+	@kw = $sto->search->msg_keywords($docids->[0]);
 	is_deeply(\@kw, [], 'kw matches after remove (idempotent)');
 
-	$docids = $lst->add_eml_keywords($eml, qw(answered));
+	$docids = $sto->add_eml_keywords($eml, qw(answered));
 	is(scalar @$docids, 1, 'added to empty doc');
-	$lst->done;
-	@kw = $lst->search->msg_keywords($docids->[0]);
+	$sto->done;
+	@kw = $sto->search->msg_keywords($docids->[0]);
 	is_deeply(\@kw, ['answered'], 'kw matches after add');
 
-	$docids = $lst->set_eml_keywords($eml);
+	$docids = $sto->set_eml_keywords($eml);
 	is(scalar @$docids, 1, 'set to clobber');
-	$lst->done;
-	@kw = $lst->search->msg_keywords($docids->[0]);
+	$sto->done;
+	@kw = $sto->search->msg_keywords($docids->[0]);
 	is_deeply(\@kw, [], 'set clobbers all');
 
 	my $set = eml_load('t/plack-qp.eml');
 	$set->header_set('Message-ID', "<set\@$parallel>");
-	my $ret = $lst->set_eml($set, 'seen');
+	my $ret = $sto->set_eml($set, 'seen');
 	is(ref $ret, 'PublicInbox::Smsg', 'initial returns smsg');
-	my $ids = $lst->set_eml($set, qw(seen));
+	my $ids = $sto->set_eml($set, qw(seen));
 	is_deeply($ids, [ $ret->{num} ], 'set_eml idempotent');
-	$ids = $lst->set_eml($set, qw(seen answered));
+	$ids = $sto->set_eml($set, qw(seen answered));
 	is_deeply($ids, [ $ret->{num} ], 'set_eml to change kw');
-	$lst->done;
-	@kw = $lst->search->msg_keywords($ids->[0]);
+	$sto->done;
+	@kw = $sto->search->msg_keywords($ids->[0]);
 	is_deeply(\@kw, [qw(answered seen)], 'set changed kw');
 }
 
 SKIP: {
 	require_mods(qw(Storable), 1);
-	ok($lst->can('ipc_do'), 'ipc_do works if we have Storable');
+	ok($sto->can('ipc_do'), 'ipc_do works if we have Storable');
 	$eml->header_set('Message-ID', '<ipc-test@example>');
-	my $pid = $lst->ipc_worker_spawn('lei-store');
+	my $pid = $sto->ipc_worker_spawn('lei-store');
 	ok($pid > 0, 'got a worker');
-	my $smsg = $lst->ipc_do('set_eml', $eml, qw(seen));
+	my $smsg = $sto->ipc_do('set_eml', $eml, qw(seen));
 	is(ref($smsg), 'PublicInbox::Smsg', 'set_eml works over ipc');
-	my $ids = $lst->ipc_do('set_eml', $eml, qw(seen));
+	my $ids = $sto->ipc_do('set_eml', $eml, qw(seen));
 	is_deeply($ids, [ $smsg->{num} ], 'docid returned');
 
 	$eml->header_set('Message-ID');
-	my $no_mid = $lst->ipc_do('set_eml', $eml, qw(seen));
-	my $wait = $lst->ipc_do('done');
-	my @kw = $lst->search->msg_keywords($no_mid->{num});
+	my $no_mid = $sto->ipc_do('set_eml', $eml, qw(seen));
+	my $wait = $sto->ipc_do('done');
+	my @kw = $sto->search->msg_keywords($no_mid->{num});
 	is_deeply(\@kw, [qw(seen)], 'ipc set changed kw');
 
 	is(ref($smsg), 'PublicInbox::Smsg', 'no mid works ipc');
-	$ids = $lst->ipc_do('set_eml', $eml, qw(seen));
+	$ids = $sto->ipc_do('set_eml', $eml, qw(seen));
 	is_deeply($ids, [ $no_mid->{num} ], 'docid returned w/o mid w/ ipc');
-	$lst->ipc_do('done');
-	$lst->ipc_worker_stop;
-	$ids = $lst->ipc_do('set_eml', $eml, qw(seen answered));
+	$sto->ipc_do('done');
+	$sto->ipc_worker_stop;
+	$ids = $sto->ipc_do('set_eml', $eml, qw(seen answered));
 	is_deeply($ids, [ $no_mid->{num} ], 'docid returned w/o mid w/o ipc');
-	$wait = $lst->ipc_do('done');
-	@kw = $lst->search->msg_keywords($no_mid->{num});
+	$wait = $sto->ipc_do('done');
+	@kw = $sto->search->msg_keywords($no_mid->{num});
 	is_deeply(\@kw, [qw(answered seen)], 'set changed kw w/o ipc');
 }
 

  parent reply	other threads:[~2021-02-26  9:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-26  9:41 [PATCH 0/5] lei mbox locking Eric Wong
2021-02-26  9:41 ` [PATCH 1/5] lei: style fix for $oldset declaration Eric Wong
2021-02-26  9:41 ` [PATCH 2/5] lei q: support mbox locking by default Eric Wong
2021-02-26  9:41 ` [PATCH 3/5] lei import|convert: support mbox locking on reads Eric Wong
2021-02-26 21:03   ` [SQUASH 6/5] require MboxLock even for .eml files Eric Wong
2021-02-26  9:41 ` Eric Wong [this message]
2021-02-26  9:41 ` [PATCH 5/5] lei_xsearch: more detail about ->xdb call chain Eric Wong

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=20210226094141.11514-5-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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

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).