Skip to content

Commit fccf41e

Browse files
peffgitster
authored andcommitted
t9700: loosen ident timezone regex
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f421e02 commit fccf41e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

t/t9700/test.pl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ sub adjust_dirsep {
5959
open STDERR, ">&", $tmpstderr or die "cannot restore STDERR";
6060

6161
# ident
62-
like($r->ident("aUthor"), qr/^A U Thor <author\@example.com> [0-9]+ \+0000$/,
62+
like($r->ident("aUthor"), qr/^A U Thor <author\@example.com> [0-9]+ [+-]\d{4}$/,
6363
"ident scalar: author (type)");
64-
like($r->ident("cOmmitter"), qr/^C O Mitter <committer\@example.com> [0-9]+ \+0000$/,
64+
like($r->ident("cOmmitter"), qr/^C O Mitter <committer\@example.com> [0-9]+ [+-]\d{4}$/,
6565
"ident scalar: committer (type)");
6666
is($r->ident("invalid"), "invalid", "ident scalar: invalid ident string (no parsing)");
6767
my ($name, $email, $time_tz) = $r->ident('author');
6868
is_deeply([$name, $email], ["A U Thor", "author\@example.com"],
6969
"ident array: author");
70-
like($time_tz, qr/[0-9]+ \+0000/, "ident array: author");
70+
like($time_tz, qr/[0-9]+ [+-]\d{4}/, "ident array: author");
7171
is_deeply([$r->ident("Name <email> 123 +0000")], ["Name", "email", "123 +0000"],
7272
"ident array: ident string");
7373
is_deeply([$r->ident("invalid")], [], "ident array: invalid ident string");

0 commit comments

Comments
 (0)