freebsd-ports/lang/perl5.18/files/patch-cpan_podlators_t_devise-date.t
Mathieu Arnold bfee655ccf Make Perl build more reproducibly.
Differential Revision:	https://reviews.freebsd.org/D2016
Some bits from:	Jérémy Bobbio <lunar@debian.org>
Sponsored by:	Absolight
2015-04-09 12:21:29 +00:00

39 lines
1.2 KiB
Perl

--- cpan/podlators/t/devise-date.t.orig 2014-01-31 21:55:51 UTC
+++ cpan/podlators/t/devise-date.t
@@ -1,15 +1,28 @@
-#!/usr/bin/perl -w
-
-# In order for MakeMaker to build in the core, nothing can use
-# Fcntl which includes POSIX. devise_date()'s use of strftime()
-# was replaced. This tests that it's identical.
+#!/usr/bin/perl
+#
+# In order for MakeMaker to build in the core, nothing can use Fcntl which
+# includes POSIX. devise_date()'s use of strftime() was replaced. This tests
+# that it's identical. It also tests special handling of the POD_MAN_DATE
+# environment variable.
+use 5.006;
use strict;
-
-use Test::More tests => 1;
+use warnings;
use Pod::Man;
use POSIX qw(strftime);
+use Test::More tests => 2;
+
+# Check that the results of device_date matches strftime. There is no input
+# file name, so this will use the current time.
my $parser = Pod::Man->new;
-is $parser->devise_date, strftime("%Y-%m-%d", localtime);
+is(
+ $parser->devise_date,
+ strftime('%Y-%m-%d', localtime()),
+ 'devise_date matches strftime'
+);
+
+# Set the override environment variable and ensure that it's honored.
+local $ENV{POD_MAN_DATE} = '2014-01-01';
+is($parser->devise_date, '2014-01-01', 'devise_date honors POD_MAN_DATE');