You have some duplicated code

spyOn: aBlock reportOtherProcesses: aBoolean cutoff: aNumber openResultWindow: 
openResultWindow

        | node result |
        node := self new.
        node reportOtherProcesses: aBoolean.
        result := node spyEvery: self defaultPollPeriod on: aBlock.
        
        openResultWindow ifTrue:
         [ (CodeHolder new contents: (String streamContents: [:s | node report: 
s cutoff: aNumber; close]))
                openLabel: 'Spy Results' wrap: false ].
        
        ^ node
        "^ result"

spyOn: aBlock reportOtherProcesses: aBoolean cutoff: aNumber openResultWindow: 
openResultWindow closeAfter: closeAfter

        | node result |
        node := self new.
        node reportOtherProcesses: aBoolean.
        result := node spyEvery: self defaultPollPeriod on: aBlock.
        
        openResultWindow ifTrue:
         [ (CodeHolder new contents: (String streamContents: [:s | node report: 
s cutoff: aNumber]))
                openLabel: 'Spy Results' wrap: false ].
        
        closeAfter ifTrue: [ node close ].
        
        ^ node
        "^ result"

It is a good idea to have some tests. Now maybe you should not rely on float 
printString but 
one a mock class else if we change float printing these tests will break.

Stef


On Mar 16, 2010, at 2:15 AM, Alexandre Bergel wrote:

> Waiting in PharoInbox. This fix has been developed in a 11271.
> 
> SLICE-MessageTallyCleaningAndTest-Alexandre_Bergel.1
> 
> 
> This slices comprises an update for two packages, Tools and ToolsTest.
> The new version of Tools clean MessageTally. A user of MessageTally may now 
> decide whether he
> wants to close the tally. Although it is convenient to close it (in order to 
> not keep a reference of the
> compiled method and the class), this behavior is not always wished. 
> Especially when test have to be
> written!
> The user has now the option to not open the result window.
> 
> ToolsTest contains few and simple tests.
> 
> Cheers,
> Alexandre
> -- 
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
> 
> 
> 
> 
> 
> -- 
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to