From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id A21401F5AE for ; Thu, 9 Jul 2020 20:35:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726299AbgGIUfv (ORCPT ); Thu, 9 Jul 2020 16:35:51 -0400 Received: from cloud.peff.net ([104.130.231.41]:53528 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726196AbgGIUfv (ORCPT ); Thu, 9 Jul 2020 16:35:51 -0400 Received: (qmail 5795 invoked by uid 109); 9 Jul 2020 20:35:51 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Thu, 09 Jul 2020 20:35:51 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 24996 invoked by uid 111); 9 Jul 2020 20:35:51 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Thu, 09 Jul 2020 16:35:51 -0400 Authentication-Results: peff.net; auth=none Date: Thu, 9 Jul 2020 16:35:50 -0400 From: Jeff King To: git@vger.kernel.org Cc: Junio C Hamano , Han-Wen Nienhuys Subject: [PATCH 2/4] t9700: loosen ident timezone regex Message-ID: <20200709203550.GB661064@coredump.intra.peff.net> References: <20200709203336.GA2748777@coredump.intra.peff.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200709203336.GA2748777@coredump.intra.peff.net> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org A few of the perl tests in t9700 ask for the author and committer ident, and then make sure we get something sensible. For the timestamp portion, we just match [0-9]+, because the actual value will depend on when the test is run. However, we do require that the timezone be "+0000". This works reliably because we set $TZ in test-lib.sh. But in preparation for changing the default timezone, let's be a bit more flexible. We don't actually care about the exact value here, just that we were able to get a sensible output from the perl module's access methods. Signed-off-by: Jeff King --- Alternatively, we could use test_tick here and then make sure we got the expected timestamp. Or revisit it after patch 4 and use the default date from there. But I think the intent of the tests is fulfilled by remaining flexible. t/t9700/test.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/t/t9700/test.pl b/t/t9700/test.pl index 34cd01366f..c59a015f89 100755 --- a/t/t9700/test.pl +++ b/t/t9700/test.pl @@ -59,15 +59,15 @@ sub adjust_dirsep { open STDERR, ">&", $tmpstderr or die "cannot restore STDERR"; # ident -like($r->ident("aUthor"), qr/^A U Thor [0-9]+ \+0000$/, +like($r->ident("aUthor"), qr/^A U Thor [0-9]+ [+-]\d{4}$/, "ident scalar: author (type)"); -like($r->ident("cOmmitter"), qr/^C O Mitter [0-9]+ \+0000$/, +like($r->ident("cOmmitter"), qr/^C O Mitter [0-9]+ [+-]\d{4}$/, "ident scalar: committer (type)"); is($r->ident("invalid"), "invalid", "ident scalar: invalid ident string (no parsing)"); my ($name, $email, $time_tz) = $r->ident('author'); is_deeply([$name, $email], ["A U Thor", "author\@example.com"], "ident array: author"); -like($time_tz, qr/[0-9]+ \+0000/, "ident array: author"); +like($time_tz, qr/[0-9]+ [+-]\d{4}/, "ident array: author"); is_deeply([$r->ident("Name 123 +0000")], ["Name", "email", "123 +0000"], "ident array: ident string"); is_deeply([$r->ident("invalid")], [], "ident array: invalid ident string"); -- 2.27.0.730.gcc195a083d