summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1997-02-22 20:34:30 +0000
committerJim Meyering <jim@meyering.net>1997-02-22 20:34:30 +0000
commit75bc50c6fcb7239dceacb5aaffdac7f9f47f609b (patch)
tree4c8bcf7f5ba6b28fbd3c0155e64a42e55a20f06e /tests
parent5cb0201730e536db257e9b2183ab002935d8ea24 (diff)
downloadcoreutils-75bc50c6fcb7239dceacb5aaffdac7f9f47f609b.tar.xz
.
Diffstat (limited to 'tests')
-rw-r--r--tests/date/Test.pm20
1 files changed, 15 insertions, 5 deletions
diff --git a/tests/date/Test.pm b/tests/date/Test.pm
index faacee958..ea19e609c 100644
--- a/tests/date/Test.pm
+++ b/tests/date/Test.pm
@@ -11,19 +11,21 @@ $Test::env_default = ['LANG=C TZ=UTC'];
sub test_vector
{
- my $d1 = '1997-01-19 08:17:48 +0';
+ my $t0 = '08:17:48';
+ my $d0 = '1997-01-19';
+ my $d1 = "$d0 $t0 +0";
my @tvec =
(
# test-name options input expected-output expected-return-code
#
['1', "-d '$d1' +'%% %a %A %b %B'", {}, '% Sun Sunday Jan January', 0],
- ['2', "-d '$d1' +'%c'", {}, 'Sun Jan 19 08:17:48 1997', 0],
+ ['2', "-d '$d1' +'%c'", {}, "Sun Jan 19 $t0 1997", 0],
['3', "-d '$d1' +'%d_%D_%e_%h_%H'", {}, '19_01/19/97_19_Jan_08', 0],
['4', "-d '$d1' +'%I_%j_%k_%l_%m'", {}, '08_019_ 8_ 8_01', 0],
- ['5', "-d '$d1' +'%M_%n_%p_%r'", {}, "17_\n_AM_08:17:48 AM", 0],
- ['6', "-d '$d1' +'%s_%S_%t_%T'", {}, "853661868_48_\t_08:17:48", 0],
+ ['5', "-d '$d1' +'%M_%n_%p_%r'", {}, "17_\n_AM_$t0 AM", 0],
+ ['6', "-d '$d1' +'%s_%S_%t_%T'", {}, "853661868_48_\t_$t0", 0],
['7', "-d '$d1' +'%U_%V_%w_%W'", {}, '03_03_0_02', 0],
- ['8', "-d '$d1' +'%x_%X_%y_%Y'", {}, '01/19/97_08:17:48_97_1997', 0],
+ ['8', "-d '$d1' +'%x_%X_%y_%Y'", {}, "01/19/97_${t0}_97_1997", 0],
['9', "-d '$d1' +'%z_%Z'", {}, '+0000_GMT', 0],
['leap-1', "--date '02/29/1996 1 year' +%Y-%m-%d", {}, '1997-03-01', 0],
@@ -46,6 +48,14 @@ sub test_vector
['millen-1', "--date '1998-1-1 3 years' +%Y", {}, '2001', 0],
+ ['rel-0', "-d '$d1 now' '+%Y-%m-%d %T'", {}, "$d0 $t0", 0],
+ ['rel-1', "-d '$d1 yesterday' '+%Y-%m-%d %T'", {}, "1997-01-18 $t0", 0],
+ ['rel-2', "-d '$d1 tomorrow' '+%Y-%m-%d %T'", {}, "1997-01-20 $t0", 0],
+ ['rel-3', "-d '$d1 1 day ago' '+%Y-%m-%d %T'", {}, "1997-01-18 $t0", 0],
+ ['rel-4', "-d '$d1 2 hours ago' '+%Y-%m-%d %T'", {}, "$d0 06:17:48", 0],
+ ['rel-5', "-d '$d1 3 minutes ago' '+%Y-%m-%d %T'", {}, "$d0 08:14:48", 0],
+ ['rel-6', "-d '$d1 4 seconds ago' '+%Y-%m-%d %T'", {}, "$d0 08:17:44", 0],
+
# FIXME: add a lot more...
);