Hi, we created a project in SqueakSource called SUnitExtensions with extensions we added to SUnit. This package is needed to run the test of Aconcagua (see next mail!) The extensions are: * TestCase>>should: aBlock raise: anException withExceptionDo: anotherBlock * TestCase>>should: aBlock notTakeMoreThanMilliseconds: anInteger * TestCase>>fail
This are very useful methods... it would be nice to have them in the SUnit package... Right now we created this package to be able to run the Aconcagua tests. If they are added to the SUnit package, we can delete it.
See http://www.squeaksource.com/SUnitExtensions.html
Bye, Hernan.
--- In squeak@yahoogroups.com, "Philippe Marschall" <philippe.marschall@...> wrote:
* TestCase>>should: aBlock notTakeMoreThanMilliseconds: anInteger
Shouldn't that be
- TestCase>>shouldnt: aBlock takeMoreThan: aDuration
milliSeconds would then be sent to anInteger
self shouldnt: [ ... ] takeMoreThan: 5 milliSeconds
Well, the problem is that your suggestion is not portable to other Smalltalk (like VisualAge or GemStone, that are the ones we use...) But yes, I agree that your suggestion is better. I'd like this methods to be part of SUnit, so I guess the people that maintain SUnit should have the last word about this.
Hernan.
Cheers Philippe
On 28.03.2006, at 00:08, Hernan Wilkinson wrote:
The extensions are: * TestCase>>should: aBlock raise: anException withExceptionDo: anotherBlock
- TestCase>>should: aBlock notTakeMoreThanMilliseconds: anInteger
- TestCase>>fail
This are very useful methods... it would be nice to have them in the SUnit package...
Ok, merged in in SUnit-md.32
(But keep in mind that this is the Squeak branch of Sunit... not the "beeing compatible to even the strangest smalltalk at the expense of getting nothing done at all" official SUnit)
Name: SUnit-md.32 Author: md Time: 2 April 2006, 2:05:33 pm UUID: fcc38149-c240-11da-8443-000d933a223c Ancestors: SUnit-md.31
From: hernan.wilkinson@mercapsoftware.com Subject: [ANN] SUnitExtensions Date: 28. März 2006 00:08:05 GMT+02:00 To: squeak-dev@lists.squeakfoundation.org Reply-To: squeak-dev@lists.squeakfoundation.org
The extensions are: * TestCase>>should: aBlock raise: anException withExceptionDo: anotherBlock * TestCase>>should: aBlock notTakeMoreThanMilliseconds: anInteger * TestCase>>fail
This are very useful methods... it would be nice to have them in the SUnit package...
Hi,
* TestCase>>should: aBlock notTakeMoreThanMilliseconds: anInteger
Would it not be nicer to implement this using ANSI Durations rather then milliseconds ? Something akin to #valueWithin:onTimeout:
My suggestion would be
self assert: [ x doSomething ] within: 5 seconds.
Cheers
Brent
On 02.04.2006, at 16:08, Brent Pinkney wrote:
Hi,
* TestCase>>should: aBlock notTakeMoreThanMilliseconds: anInteger
Would it not be nicer to implement this using ANSI Durations rather then milliseconds ? Something akin to #valueWithin:onTimeout:
Yes, I think phillipe suggested the same... let's do it.
My suggestion would be
self assert: [ x doSomething ] within: 5 seconds.
hmm... assert: allways takes an expression, should: takes a block in SUnit. (the standard Object>>#assert: can have both a bock and a expression).
So for Sunit, it would be something like:
self shouldnt: [1 + 2] takeMoreThan: 3 seconds or
self should: [1 + 2] takeNoMoreThan: 3 seconds
or, we could make change TestCase assert: to be like Object>>#assert: and provide
TestCase>>#assert: [ x doSomething ] within: 5 seconds.
Or just both? having TestCase>>#assert: to be the same semantics like Objects>>assert: definitly makes sense...
Marcus
squeak-dev@lists.squeakfoundation.org