From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id CF3F71F786 for ; Tue, 23 Jul 2024 21:28:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1721770118; bh=hd7A6+FtlttsIcJOJYEvz6GI7G2PwNqblrzQs5kTRkE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=M2gW61W8ssuAJe1bgo6mtmV9MFKcJ5/9+LoGx+4Lz+J9vO6CA1gUXPt45tj1TXtou dnzmPjsEScMQVI5eay++FLg6zA5ZEu6mWQTbeiQq/btsFzrDcd+TWtsjVGOR8q7LYF XXL4G/577qLh4ymkqW3J8x5zRQkKcsys2czqVGXE= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 4/4] t/v2writable: use 5.10.1 and autodie more Date: Tue, 23 Jul 2024 21:28:37 +0000 Message-ID: <20240723212837.3931413-5-e@80x24.org> In-Reply-To: <20240723212837.3931413-1-e@80x24.org> References: <20240723212837.3931413-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Switching to Perl v5.12 will require more review due to unicode_strings, but 5.10.1 is an easy change and we can rely more on autodie to simplify error checking. --- t/v2writable.t | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/t/v2writable.t b/t/v2writable.t index 93385456..c016b049 100644 --- a/t/v2writable.t +++ b/t/v2writable.t @@ -1,15 +1,14 @@ -# Copyright (C) 2018-2021 all contributors +#!perl -w +# Copyright (C) all contributors # License: AGPL-3.0+ -use strict; -use warnings; -use Test::More; +use v5.10.1; # FIXME: check 5.12 unicode_strings compat use PublicInbox::Eml; use PublicInbox::ContentHash qw(content_digest content_hash); use PublicInbox::TestCommon; use PublicInbox::Spawn qw(popen_rd); use Config; use Cwd qw(abs_path); -use autodie qw(kill open read); +use autodie qw(chmod close kill open read); require_git(2.6); require_mods(qw(DBD::SQLite Xapian)); local $ENV{HOME} = abs_path('t'); @@ -157,16 +156,15 @@ SELECT COUNT(*) FROM over WHERE num > 0 my $out = "$inboxdir/stdout.log"; my $group = 'inbox.comp.test.v2writable'; my $pi_config = "$inboxdir/pi_config"; - open my $fh, '>', $pi_config or die "open: $!\n"; - print $fh <', $pi_config; + print $fh <{parallel} = 0; $v2w->init_inbox(0); my $alt = "$tmp->{inboxdir}/all.git/objects/info/alternates"; - open my $fh, '>>', $alt or die $!; - print $fh "$inboxdir/all.git/objects\n" or die $!; - chmod(0664, $fh) or die "fchmod: $!"; - close $fh or die $!; - open $fh, '<', $alt or die $!; + open my $fh, '>>', $alt; + print $fh "$inboxdir/all.git/objects\n"; + chmod 0664, $fh; + close $fh; + open $fh, '<', $alt; my $before = do { local $/; <$fh> }; ok($v2w->{mg}->add_epoch(3), 'init a new epoch'); - open $fh, '<', $alt or die $!; + open $fh, '<', $alt; my $after = do { local $/; <$fh> }; ok(index($after, $before) > 0, 'old contents preserved after adding epoch');