summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorDenis Vlasenko2008-04-25 02:14:07 +0000
committerDenis Vlasenko2008-04-25 02:14:07 +0000
commit4d89a8bd1d6a081be559656b67f4adfc75137740 (patch)
tree945ac3875df35b589450354fdece8007407cf509 /testsuite
parentad6cab18341dc2df832f0b8fea966e3fb57eef03 (diff)
downloadbusybox-4d89a8bd1d6a081be559656b67f4adfc75137740.zip
busybox-4d89a8bd1d6a081be559656b67f4adfc75137740.tar.gz
date: make it accept ISO date format. Fix help text.
make testsuite actually test something useful. function old new delta date_main 1094 1149 +55
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/date/date-works45
1 files changed, 44 insertions, 1 deletions
diff --git a/testsuite/date/date-works b/testsuite/date/date-works
index 3ecaeea..f726bab 100644
--- a/testsuite/date/date-works
+++ b/testsuite/date/date-works
@@ -1 +1,44 @@
-test x"`date`" = x"`busybox date`"
+dt=`busybox date`
+# Expected format: Fri Apr 25 03:47:55 CEST 2008
+dt=`echo "$dt" | sed 's/^[^ ][^ ][^ ] [^ ][^ ][^ ] [ 0123][0-9] [012][0-9]:[0-5][0-9]:[0-6][0-9] [A-Z][A-Z]* [012][0-9][0-9][0-9]$/OK/'`
+test x"$dt" = x"OK"
+
+dt=`busybox date -d 1:2`
+dt=`echo "$dt" | cut -b1-19`
+test x"$dt" = x"Fri Apr 25 01:02:00"
+
+dt=`busybox date -d 1:2:3`
+dt=`echo "$dt" | cut -b1-19`
+test x"$dt" = x"Fri Apr 25 01:02:03"
+
+dt=`busybox date -d 1.2-3:4`
+dt=`echo "$dt" | cut -b1-19`
+test x"$dt" = x"Wed Jan 2 03:04:00"
+
+dt=`busybox date -d 1.2-3:4:5`
+dt=`echo "$dt" | cut -b1-19`
+test x"$dt" = x"Wed Jan 2 03:04:05"
+
+dt=`busybox date -d 1999.1.2-3:4`
+dt=`echo "$dt" | cut -b1-19`
+test x"$dt" = x"Sat Jan 2 03:04:00"
+
+dt=`busybox date -d 1999.1.2-3:4:5`
+dt=`echo "$dt" | cut -b1-19`
+test x"$dt" = x"Sat Jan 2 03:04:05"
+
+dt=`busybox date -d '1999-1-2 3:4:5'`
+dt=`echo "$dt" | cut -b1-19`
+test x"$dt" = x"Sat Jan 2 03:04:05"
+
+dt=`busybox date -d 01231133`
+dt=`echo "$dt" | cut -b1-19`
+test x"$dt" = x"Wed Jan 23 11:33:00"
+
+dt=`busybox date -d 012311332000`
+dt=`echo "$dt" | cut -b1-19`
+test x"$dt" = x"Sun Jan 23 11:33:00"
+
+dt=`busybox date -d 012311332000.30`
+dt=`echo "$dt" | cut -b1-19`
+test x"$dt" = x"Sun Jan 23 11:33:30"