[squeak-dev] The Trunk: SUnit-ul.72.mcz
Nicolas Cellier
nicolas.cellier.aka.nice at gmail.com
Fri Dec 4 08:42:05 UTC 2009
2009/12/4 Igor Stasenko <siguctua at gmail.com>:
> 2009/12/4 <commits at source.squeak.org>:
>> Levente Uzonyi uploaded a new version of SUnit to project The Trunk:
>> http://source.squeak.org/trunk/SUnit-ul.72.mcz
>>
>> ==================== Summary ====================
>>
>> Name: SUnit-ul.72
>> Author: ul
>> Time: 4 December 2009, 3:49:32 am
>> UUID: d7af06fb-2952-0142-a41d-39b4547ded99
>> Ancestors: SUnit-ul.71
>>
>> - speed up TestCase >> allTestSelectors
>>
>> =============== Diff against SUnit-nice.70 ===============
>>
>> Item was changed:
>> ----- Method: TestCase class>>allTestSelectors (in category 'accessing') -----
>> allTestSelectors
>>
>> + ^(self allSelectors asArray select: [ :each |
>
> Some nitpicking :)
>
> Levente, why sending #asArray necessary here?
> If method is expected to return an array, then why not just put it at
> end 'sort asArray' ?
>
> Oh, and if you want to make it really fast then it could be done
> something like this:
>
> | selectors |
> selectors := SortedCollection new.
> self selectorsDo: [:each |
> ((each beginsWith: 'test') and: [ each last ~= $: ]) ifTrue: [
> methods add: each ] ].
> ^ selectors asArray
>
> this implementation will avoid creating 2 extra temporary collections
> (in #allSelectors and in #select:)
>
But #allSelectors is not #selectors. It includes all superclasses
selectors... And it is a Set to avoid duplicates.
Nicolas
>> + (each beginsWith: 'test') and: [ each numArgs isZero ] ]) sort
>> - ^self allSelectors asSortedCollection asOrderedCollection select: [:each |
>> - ('test*' match: each) and: [each numArgs isZero]]
>> !
>>
>>
>>
>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>
>
More information about the Squeak-dev
mailing list
|