about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2024-01-31 10:20:20 +0000
committerEric Wong <e@80x24.org>2024-02-01 21:00:17 +0000
commit58fea974d2857c69e15d974cb62f8cabeeb32792 (patch)
treeb5142e86fe89775253fdc15af6a6e3efaaa6822f /t
parent11694c6d0bc3cdabf2bfeb9acc0f0a810ac1667f (diff)
downloadpublic-inbox-58fea974d2857c69e15d974cb62f8cabeeb32792.tar.gz
MH sequence numbers can be analogous to IMAP UIDs and NNTP
article numbers (or more like IMAP MSNs with clients which
pack).  In any case, sort then numerically by default to avoid
surprising users who treat NNTP spools and mlmmj archives as MH
folders.  This gives more coherent git history and resulting
NNTP/IMAP numbering when round-tripping MH -> v2 -> (NNTP|IMAP) -> MH
Diffstat (limited to 't')
-rw-r--r--t/mh_reader.t14
1 files changed, 10 insertions, 4 deletions
diff --git a/t/mh_reader.t b/t/mh_reader.t
index 711fc8aa..c81df32e 100644
--- a/t/mh_reader.t
+++ b/t/mh_reader.t
@@ -7,6 +7,7 @@ use PublicInbox::IO qw(write_file);
 use PublicInbox::Lock;
 use PublicInbox::OnDestroy;
 use PublicInbox::Eml;
+use File::Path qw(remove_tree);
 use autodie;
 opendir my $cwdfh, '.';
 
@@ -103,12 +104,17 @@ test_lei(sub {
         like $lei_out, qr/^Subject: msg 4\nStatus: RO\n\n\n/ms,
                 "message retrieved after `lei index'";
 
+        lei_ok qw(convert -s none -f text), "mh:$for_sort", \'--sort=none';
+
         # ensure sort works for _input_ when output disallows sort
         my $v2out = "$ENV{HOME}/v2-out";
-        lei_ok qw(convert -s sequence), "mh:$for_sort", '-o', "v2:$v2out";
-        my $git = PublicInbox::Git->new("$v2out/git/0.git");
-        chomp(my @l = $git->qx(qw(log --pretty=oneline --format=%s)));
-        is_xdeeply \@l, [1, 22, 333], 'sequence order preserved for v2';
+        for my $sort (['--sort=sequence'], []) { # sequence is the default
+                lei_ok qw(convert), @$sort, "mh:$for_sort", '-o', "v2:$v2out";
+                my $g = PublicInbox::Git->new("$v2out/git/0.git");
+                chomp(my @l = $g->qx(qw(log --pretty=oneline --format=%s)));
+                is_xdeeply \@l, [1, 22, 333], 'sequence order preserved for v2';
+                File::Path::remove_tree $v2out;
+        }
 });
 
 done_testing;