...
|
...
|
@@ -5,30 +5,33 @@ use Test::More;
|
5
|
5
|
use Gitprep::Git;
|
6
|
6
|
|
7
|
7
|
my @cases = (
|
8
|
|
- { stimulus => 0, expected => ' right now' },
|
9
|
|
- { stimulus => 1, expected => 'a sec ago' },
|
10
|
|
- { stimulus => 59, expected => '59 sec ago' },
|
11
|
|
- { stimulus => 60, expected => 'a min ago' },
|
12
|
|
- { stimulus => 60 + 1, expected => 'a min ago' },
|
13
|
|
- { stimulus => 2 * 60 - 1, expected => 'a min ago' },
|
14
|
|
- { stimulus => 2 * 60, expected => '2 min ago' },
|
15
|
|
- { stimulus => 2 * 60 + 1, expected => '2 min ago' },
|
16
|
|
- { stimulus => 60 * 60 - 1, expected => '59 min ago' },
|
17
|
|
- { stimulus => 60 * 60, expected => 'a hour ago' },
|
18
|
|
- { stimulus => 60 * 60 + 1, expected => 'a hour ago' },
|
19
|
|
- { stimulus => 61 * 60, expected => 'a hour ago' },
|
20
|
|
- { stimulus => 24 * 60 * 60 - 1, expected => '23 hours ago' },
|
21
|
|
- { stimulus => 24 * 60 * 60, expected => 'a day ago' },
|
22
|
|
- { stimulus => 24 * 60 * 60 + 1, expected => 'a day ago' },
|
23
|
|
- { stimulus => 7 * 24 * 60 * 60 - 1, expected => '6 days ago' },
|
24
|
|
- { stimulus => 7 * 24 * 60 * 60, expected => 'a week ago' },
|
25
|
|
- { stimulus => 7 * 24 * 60 * 60 + 1, expected => 'a week ago' },
|
26
|
|
- { stimulus => (365/12) * 24 * 60 * 60 - 1, expected => '4 weeks ago' },
|
27
|
|
- { stimulus => (365/12) * 24 * 60 * 60, expected => 'a month ago' },
|
28
|
|
- { stimulus => (365/12) * 24 * 60 * 60 + 1, expected => 'a month ago' },
|
29
|
|
- { stimulus => 365 * 24 * 60 * 60 - 1, expected => '11 months ago' },
|
30
|
|
- { stimulus => 365 * 24 * 60 * 60, expected => 'a year ago' },
|
31
|
|
- { stimulus => 365 * 24 * 60 * 60 + 1, expected => 'a year ago' },
|
|
8
|
+ { stimulus => 0, expected => ' right now' },
|
|
9
|
+ { stimulus => 1, expected => 'a sec ago' },
|
|
10
|
+ { stimulus => 59, expected => '59 sec ago' },
|
|
11
|
+ { stimulus => 60, expected => 'a min ago' },
|
|
12
|
+ { stimulus => 60 + 1, expected => 'a min ago' },
|
|
13
|
+ { stimulus => 2 * 60 - 1, expected => 'a min ago' },
|
|
14
|
+ { stimulus => 2 * 60, expected => '2 min ago' },
|
|
15
|
+ { stimulus => 2 * 60 + 1, expected => '2 min ago' },
|
|
16
|
+ { stimulus => 60 * 60 - 1, expected => '59 min ago' },
|
|
17
|
+ { stimulus => 60 * 60, expected => 'a hour ago' },
|
|
18
|
+ { stimulus => 60 * 60 + 1, expected => 'a hour ago' },
|
|
19
|
+ { stimulus => 61 * 60, expected => 'a hour ago' },
|
|
20
|
+ { stimulus => 24 * 60 * 60 - 1, expected => '23 hours ago' },
|
|
21
|
+ { stimulus => 24 * 60 * 60, expected => 'a day ago' },
|
|
22
|
+ { stimulus => 24 * 60 * 60 + 1, expected => 'a day ago' },
|
|
23
|
+ { stimulus => 7 * 24 * 60 * 60 - 1, expected => '6 days ago' },
|
|
24
|
+ { stimulus => 7 * 24 * 60 * 60, expected => 'a week ago' },
|
|
25
|
+ { stimulus => 7 * 24 * 60 * 60 + 1, expected => 'a week ago' },
|
|
26
|
+ { stimulus => (365/12) * 24 * 60 * 60 - 1, expected => '4 weeks ago' },
|
|
27
|
+ { stimulus => (365/12) * 24 * 60 * 60, expected => 'a month ago' },
|
|
28
|
+ { stimulus => (365/12) * 24 * 60 * 60 + 1, expected => 'a month ago' },
|
|
29
|
+ { stimulus => 365 * 24 * 60 * 60 - 1, expected => '11 months ago' },
|
|
30
|
+ { stimulus => 365 * 24 * 60 * 60, expected => 'a year ago' },
|
|
31
|
+ { stimulus => 365 * 24 * 60 * 60 + 1, expected => 'a year ago' },
|
|
32
|
+ { stimulus => 2 * 365 * 24 * 60 * 60 - 1, expected => 'a year ago' },
|
|
33
|
+ { stimulus => 2 * 365 * 24 * 60 * 60, expected => '2 years ago' },
|
|
34
|
+ { stimulus => 2 * 365 * 24 * 60 * 60 + 1, expected => '2 years ago' },
|
32
|
35
|
);
|
33
|
36
|
|
34
|
37
|
plan ( tests => scalar @cases );
|