RegressionTests__TimeAndDateTest.st
changeset 365 b0d27286d78e
parent 346 b2a1db91f556
child 366 e522392004b2
--- a/RegressionTests__TimeAndDateTest.st	Tue Apr 07 16:11:00 2009 +0200
+++ b/RegressionTests__TimeAndDateTest.st	Thu Jun 25 17:16:50 2009 +0200
@@ -12,7 +12,7 @@
 
 !TimeAndDateTest methodsFor:'Testing'!
 
-test_01_Reading
+test_01_ReadingTimes
 
      self assert:(Time readFrom:'0:00'    ) = (Time hour:0 minute:0 second:0).
      self assert:(Time readFrom:'2:00'    ) = (Time hour:2 minute:0 second:0).     
@@ -48,6 +48,43 @@
     "
      self new test_01_Reading
     "
+!
+
+test_02_ReadingDates
+
+     self assert:(Date 
+                    readFrom:'2-may-2010'
+                    printFormat:'%d-%shortMonthName-%y' 
+                    onError:[self error]
+                  ) = (Date newDay:2 month:5 year:2010).
+
+     self assert:(Date 
+                    readFrom:'2-may-2010'
+                    printFormat:'%d-%monthName-%y' 
+                    onError:[self error]
+                  ) = (Date newDay:2 month:5 year:2010).
+
+     self assert:(Date 
+                    readFrom:'2-5-2010'
+                    printFormat:'%d-%m-%y' 
+                    onError:[self error]
+                  ) = (Date newDay:2 month:5 year:2010).
+
+     self assert:(Date 
+                    readFrom:'5/2/2010'
+                    printFormat:'%m/%d/%y' 
+                    onError:[self error]
+                  ) = (Date newDay:2 month:5 year:2010).
+
+     self assert:(Date 
+                    readFrom:'2010-5-2'
+                    printFormat:'%y-%m-%d' 
+                    onError:[self error]
+                  ) = (Date newDay:2 month:5 year:2010).
+
+    "
+     self new test_02_ReadingDates
+    "
 ! !
 
 !TimeAndDateTest class methodsFor:'documentation'!