X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fv2writable.t;h=0d1022047d49b8853a8e6a9370e3b960c5efde95;hb=65db62eb006fdbe74348f0e8f2ef9b9e938cb90b;hp=358a2bb7794ae21eef72fa534d346999471c60cb;hpb=f316b291e50f8d82eb067fbbe777ca3ffe5d7ae4;p=public-inbox.git
diff --git a/t/v2writable.t b/t/v2writable.t
index 358a2bb7..0d102204 100644
--- a/t/v2writable.t
+++ b/t/v2writable.t
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2020 all contributors
+# Copyright (C) 2018-2021 all contributors
# License: AGPL-3.0+
use strict;
use warnings;
@@ -17,6 +17,7 @@ my $ibx = {
inboxdir => $inboxdir,
name => 'test-v2writable',
version => 2,
+ -no_fsync => 1,
-primary_address => 'test@example.com',
};
$ibx = PublicInbox::Inbox->new($ibx);
@@ -148,7 +149,7 @@ SELECT COUNT(*) FROM over WHERE num > 0
}
{
- use Net::NNTP;
+ require_mods('Net::NNTP', 1);
my $err = "$inboxdir/stderr.log";
my $out = "$inboxdir/stdout.log";
my $group = 'inbox.comp.test.v2writable';
@@ -164,12 +165,11 @@ EOF
;
close $fh or die "close: $!\n";
my $sock = tcp_server();
- ok($sock, 'sock created');
my $len;
my $cmd = [ '-nntpd', '-W0', "--stdout=$out", "--stderr=$err" ];
my $env = { PI_CONFIG => $pi_config };
my $td = start_script($cmd, $env, { 3 => $sock });
- my $host_port = $sock->sockhost . ':' . $sock->sockport;
+ my $host_port = tcp_host_port($sock);
my $n = Net::NNTP->new($host_port);
$n->group($group);
my $x = $n->xover('1-');
@@ -283,6 +283,22 @@ EOF
is($msgs->[1]->{mid}, 'y'x244, 'stored truncated mid(2)');
}
+if ('UTF-8 References') {
+ my @w;
+ local $SIG{__WARN__} = sub { push @w, @_ };
+ my $msg = <
+References: <\xc4\x80\@example>
+
+EOM
+ ok($im->add(PublicInbox::Eml->new($msg."a\n")), 'UTF-8 References 1');
+ ok($im->add(PublicInbox::Eml->new($msg."b\n")), 'UTF-8 References 2');
+ $im->done;
+ ok(!grep(/Wide character/, @w), 'no wide characters') or xbail(\@w);
+}
+
my $tmp = {
inboxdir => "$inboxdir/non-existent/subdir",
name => 'nope',
@@ -308,7 +324,7 @@ ok($@, 'V2Writable fails on non-existent dir');
open $fh, '<', $alt or die $!;
my $before = do { local $/; <$fh> };
- ok($v2w->git_init(3), 'init a new epoch');
+ ok($v2w->{mg}->add_epoch(3), 'init a new epoch');
open $fh, '<', $alt or die $!;
my $after = do { local $/; <$fh> };
ok(index($after, $before) > 0,