From: Jim Meyering Date: Sat, 13 Aug 2005 14:41:39 +0000 (+0000) Subject: add a bunch more tests X-Git-Tag: CPPI-1_12~166 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9741a40764b2f0b114c7ad386eb818e429b8be59;p=platform%2Fupstream%2Fcoreutils.git add a bunch more tests --- diff --git a/tests/misc/date b/tests/misc/date index a140f96..bf98121 100755 --- a/tests/misc/date +++ b/tests/misc/date @@ -21,8 +21,65 @@ use strict; # Export TZ=UTC0 so that zone-dependent strings match. $ENV{TZ} = 'UTC0'; +my $t0 = '08:17:48'; +my $d0 = '1997-01-19'; +my $d1 = "$d0 $t0 +0"; + +my $ts = '08:17:49'; # next second +my $tm = '08:18:48'; # next minute +my $th = '09:17:48'; # next hour + +my $dd = '1997-01-20'; # next day +my $dw = '1997-01-26'; # next week +my $dm = '1997-02-19'; # next month +my $dy = '1998-01-19'; # next month + +my $fmt = "'+%Y-%m-%d %T'"; + my @Tests = ( + # test-name, [option, option, ...] {OUT=>'expected-output'} + # + ['1', "-d '$d1' +'%% %a %A %b %B'", {OUT=>'% Sun Sunday Jan January'}], + + # [Actually, skip it on *all* systems. -- this Perl code is run at + # distribution-build-time, not at configure/test time. ] + + # Skip the test of %c on SunOS4 systems. Such systems would fail this + # test because their underlying strftime doesn't handle the %c format + # properly. GNU strftime must rely on the underlying host library + # function to get locale-dependent behavior, as strftime is the only + # portable interface to that behavior. + # ['2', "-d '$d1' +'%c'", {OUT=>"Sun Jan 19 $t0 1997"}], + + ['3', "-d '$d1' +'%d_%D_%e_%h_%H'", {OUT=>'19_01/19/97_19_Jan_08'}], + ['4', "-d '$d1' +'%I_%j_%k_%l_%m'", {OUT=>'08_019_ 8_ 8_01'}], + ['5', "-d '$d1' +'%M_%n_%p_%r'", {OUT=>"17_\n_AM_$t0 AM"}], + ['6', "-d '$d1' +'%s_%S_%t_%T'", {OUT=>"853661868_48_\t_$t0"}], + ['7', "-d '$d1' +'%U_%V_%w_%W'", {OUT=>'03_03_0_02'}], + ['8', "-d '$d1' +'%x_%X_%y_%Y'", {OUT=>"01/19/97_${t0}_97_1997"}], + ['9', "-d '$d1' +'%z'", {OUT=>'+0000'}], + + ['leap-1', "--date '02/29/1996 1 year' +%Y-%m-%d", {OUT=>'1997-03-01'}], + + ['U95-1', "--date '1995-1-1' +%U", {OUT=>'01'}], + ['U95-2', "--date '1995-1-7' +%U", {OUT=>'01'}], + ['U95-3', "--date '1995-1-8' +%U", {OUT=>'02'}], + + ['U92-1', "--date '1992-1-1' +%U", {OUT=>'00'}], + ['U92-2', "--date '1992-1-4' +%U", {OUT=>'00'}], + ['U92-3', "--date '1992-1-5' +%U", {OUT=>'01'}], + + ['V92-1', "--date '1992-1-1' +%V", {OUT=>'01'}], + ['V92-2', "--date '1992-1-5' +%V", {OUT=>'01'}], + ['V92-3', "--date '1992-1-6' +%V", {OUT=>'02'}], + + ['W92-1', "--date '1992-1-1' +%W", {OUT=>'00'}], + ['W92-2', "--date '1992-1-5' +%W", {OUT=>'00'}], + ['W92-3', "--date '1992-1-6' +%W", {OUT=>'01'}], + + ['millen-1', "--date '1998-1-1 3 years' +%Y", {OUT=>'2001'}], + # This would infloop (or appear to) prior to coreutils-4.5.5, # due to a bug in strftime.c. ['wide-fmt', "-d '1999-06-01'", '+%3004Y', {OUT=>'0' x 3000 . '1999'}],