# ensure "lei up" works, since it compliments "lei q --save"
$in = $doc2->as_string;
lei_ok [qw(import -q -F eml -)], undef, { 0 => \$in, %$lei_opt };
- lei_ok qw(up -q), $s[0];
+ opendir my $dh, '.' or xbail "opendir .: $!";
+ lei_ok qw(up -q md -C), $home;
+ lei_ok qw(up -q . -C), "$home/md";
+ lei_ok qw(up -q), "/$home/md";
+ chdir($dh) or xbail "fchdir . $!";
my %after = map { $_ => 1 } glob("$home/md/cur/*");
is(delete $after{(keys(%before))[0]}, 1, 'original message kept');
is(scalar(keys %after), 1, 'one new message added');
lei_ok [qw(import -q -F eml -)], undef, { 0 => \$in, %$lei_opt };
lei_ok([qw(up mbcl2)], undef, { -C => $home, %$lei_opt });
ok(-s "$home/mbcl2" > $size, 'size increased after up');
+
+ ok(!lei(qw(up -q), $home), 'up fails w/o --save');
+
+ lei_ok qw(ls-search); my @d = split(/\n/, $lei_out);
+ lei_ok qw(ls-search -z); my @z = split(/\0/, $lei_out);
+ is_deeply(\@d, \@z, '-z output matches non-z');
+ is_deeply(\@d, [ "$home/mbcl2", "$home/md/" ],
+ 'ls-search output alphabetically sorted');
+ lei_ok qw(ls-search -l);
+ my $json = PublicInbox::Config->json->decode($lei_out);
+ ok($json && $json->[0]->{output}, 'JSON has output');
+ lei_ok qw(_complete lei up);
+ like($lei_out, qr!^\Q$home/mbcl2\E$!sm, 'complete got mbcl2 output');
+ like($lei_out, qr!^\Q$home/md/\E$!sm, 'complete got maildir output');
});
done_testing;