1 # Copyright (C) all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
3 use strict; use v5.10.1; use PublicInbox::TestCommon;
4 require_mods qw(DBD::SQLite);
9 $eml //= eml_load 't/utf8.eml';
11 $eml->header_set('Message-ID', "<$i\@example.com>");
12 my $d = "Thu, 01 Jan 1970 0$i:30:00 +0000";
13 $eml->header_set('Date', $d);
18 "v$_" => create_inbox("v$_", version => $_,
19 indexlevel => 'basic', tmpdir => "$tmp/v$_", $cb);
22 my $env = { TZ => 'UTC' };
24 for my $v (sort keys %ibx) {
25 my $opt = { -C => $ibx{$v}->{inboxdir}, 1 => \$out, 2 => \$err };
27 ($out, $err) = ('', '');
28 run_script([ qw(-index -vv) ], $env, $opt);
29 is($?, 0, 'no error on initial index');
31 for my $x (qw(until before)) {
32 ($out, $err) = ('', '');
33 run_script([ qw(-index --reindex -vv),
34 "--$x=1970-01-01T02:00:00Z" ], $env, $opt);
35 is($?, 0, "no error with --$x");
36 like($err, qr! 1/1\b!, "$x only indexed one message");
38 for my $x (qw(after since)) {
39 ($out, $err) = ('', '');
40 run_script([ qw(-index --reindex -vv),
41 "--$x=1970-01-01T02:00:00Z" ], $env, $opt);
42 is($?, 0, "no error with --$x");
43 like($err, qr! 2/2\b!, "$x only indexed one message");
46 ($out, $err) = ('', '');
47 run_script([ qw(-index --reindex -vv) ], $env, $opt);
48 is($?, 0, 'no error on initial index');
50 for my $x (qw(since before after until)) {
51 ($out, $err) = ('', '');
52 run_script([ qw(-index -v), "--$x=1970-01-01T02:00:00Z" ],
54 isnt($?, 0, "--$x fails on --reindex");