File: timedate_format.t

package info (click to toggle)
libsvn-web-perl 0.63-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 668 kB
  • ctags: 105
  • sloc: perl: 1,958; sh: 73; makefile: 4
file content (34 lines) | stat: -rw-r--r-- 787 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/perl

use strict;
use warnings;

use POSIX qw(locale_h);

use SVN::Web::action;
use Test::More tests => 4;

# Force the 'C' locale, so that tests give consistent results even if the
# user running under a non-English locale.
setlocale(LC_TIME, 'C');

my %config = (timezone        => '',
	      timedate_format => '%Y/%m/%d %H:%M:%S',
	      );

my $a = SVN::Web::action->new(config => \%config);
isa_ok($a, 'SVN::Web::action');

my $cstring = '2006-05-08T19:30:20.265743Z';

my $s = $a->format_svn_timestamp($cstring);
is($s, '2006/05/08 19:30:20');

$config{timedate_format} = '%a. %b %d, %l:%M%p';
$s = $a->format_svn_timestamp($cstring);
is($s, 'Mon. May 08,  7:30PM');

$config{timezone} = 'BST';
$s = $a->format_svn_timestamp($cstring);
is($s, 'Mon. May 08,  8:30PM');