[Pharo-project] [update 2.0] #20110

Camillo Bruni camillobruni at gmail.com
Tue Jun 5 05:55:26 EDT 2012


> testGeneralInquiries
> 	| now d t dt |
> 
> 	now  := self timeClass dateAndTimeNow.
> 	self 
> 		assert: now size = 2;
> 		assert: now last <= self timeClass now.
> 
> 	self should: [ self timeClass timeWords ] raise: MessageNotUnderstood.
> 
> 	d := '2 June 1973' asDate.
> 	t := '4:02:47 am' asTime.
> 	dt := self timeClass dateAndTimeFromSeconds: (2285280000 + 14567).
> 	self
> 		assert: dt = {d. t.}.
> 
> 
> The middle part is a GREAT example of a useful unit test…

that's called a negative test :D, assume what possible could fail in the universe and test for it :D





More information about the Pharo-dev mailing list