Nicolas Cellier uploaded a new version of SUnit to project The Trunk: http://source.squeak.org/trunk/SUnit-nice.81.mcz
==================== Summary ====================
Name: SUnit-nice.81 Author: nice Time: 27 August 2010, 10:29:17.421 pm UUID: 65e5fc98-4b2d-6046-8856-a7fe327cf920 Ancestors: SUnit-ar.80
A few ifNil: simplifications inspired by Cuis. Note how ifNotNil: cheaply replace an ensure: Block
=============== Diff against SUnit-ar.80 ===============
Item was changed: ----- Method: SUnitExtensionsTest>>stream (in category 'accessing') ----- stream + ^stream ifNil: [stream := WriteStream on: String new]! - stream isNil ifTrue: [stream := WriteStream on: String new]. - ^stream!
Item was changed: ----- Method: TestResource>>name (in category 'accessing') ----- name
+ ^name ifNil: [ self printString]! - name isNil - ifTrue: [^self printString]. - - ^name - !
Item was changed: + ----- Method: TestSuite>>tests (in category 'Accessing') ----- - ----- Method: TestSuite>>tests (in category 'accessing') ----- tests + ^ tests ifNil: [tests := OrderedCollection new] - tests isNil ifTrue: [tests := OrderedCollection new]. - ^tests !
Item was changed: ----- Method: TestResource class>>current (in category 'accessing') ----- current + ^ current ifNil: [ current := self new] - - current isNil - ifTrue: [current := self new]. - - ^current !
Item was changed: + ----- Method: TestResource class>>reset (in category 'Creation') ----- - ----- Method: TestResource class>>reset (in category 'creation') ----- reset + current ifNotNil: [:oldCurrent | + current := nil. + oldCurrent tearDown]! - - current notNil ifTrue: [ - [current tearDown] ensure: [ - current := nil]] - !
Item was changed: + ----- Method: TestSuite>>resources (in category 'Accessing') ----- - ----- Method: TestSuite>>resources (in category 'accessing') ----- resources + ^ resources ifNil: [resources := self defaultResources] - resources isNil ifTrue: [resources := self defaultResources]. - ^resources !
Item was changed: ----- Method: TestResource>>description (in category 'accessing') ----- description
+ ^description ifNil: [ '' ]! - description isNil - ifTrue: [^'']. - - ^description - !
packages@lists.squeakfoundation.org