Andreas Raab uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-ar.137.mcz ==================== Summary ==================== Name: System-ar.137 Author: ar Time: 26 August 2009, 9:42:31 am UUID: 49aa20fd-c8be-bf47-bda6-81e8a3dcdb83 Ancestors: System-ar.136 Tests for when:evaluate: with blocks. Remove EventTest while we are at it because it was a duplicate of EventManagerTest. =============== Diff against System-ar.136 =============== Item was added: + ----- Method: EventManagerTest>>testBlockReceiverNoArgs (in category 'running-dependent action') ----- + testBlockReceiverNoArgs + eventSource when: #anEvent evaluate:[self heardEvent]. + eventSource triggerEvent: #anEvent. + self should: [succeeded]! Item was added: + ----- Method: EventManagerTest>>testBlockReceiverTwoArgs (in category 'running-dependent action') ----- + testBlockReceiverTwoArgs + eventSource when: #anEvent:info: evaluate:[:arg1 :arg2| self addArg1: arg1 addArg2: arg2]. + eventSource triggerEvent: #anEvent:info: withArguments: #( 9 42 ). + self should: [(eventListener includes: 9) and: [eventListener includes: 42]]! Item was added: + ----- Method: EventManagerTest>>testBlockReceiverOneArg (in category 'running-dependent action') ----- + testBlockReceiverOneArg + eventSource when: #anEvent: evaluate:[:arg1| eventListener add: arg1]. + eventSource triggerEvent: #anEvent: with: 9. + self should: [eventListener includes: 9]! Item was removed: - ----- Method: EventTest>>testReturnValueWithManyListeners (in category 'running-dependent value') ----- - testReturnValueWithManyListeners - - | value newListener | - newListener := 'busybody'. - eventSource - when: #needsValue - send: #yourself - to: eventListener. - eventSource - when: #needsValue - send: #yourself - to: newListener. - value := eventSource triggerEvent: #needsValue. - self should: [value == newListener]! Item was removed: - ----- Method: EventTest>>addArg1:addArg2: (in category 'private') ----- - addArg1: arg1 - addArg2: arg2 - - eventListener - add: arg1; - add: arg2! Item was removed: - ----- Method: EventTest>>testNoValueSupplierHasArguments (in category 'running-broadcast query') ----- - testNoValueSupplierHasArguments - - succeeded := eventSource - triggerEvent: #needsValue: - with: 'nelja' - ifNotHandled: [true]. - self should: [succeeded]! Item was removed: - ----- Method: EventTest>>testOneArgumentEvent (in category 'running-dependent action') ----- - testOneArgumentEvent - - eventSource when: #anEvent: send: #add: to: eventListener. - eventSource triggerEvent: #anEvent: with: 9. - self should: [eventListener includes: 9]! Item was removed: - ----- Method: EventTest>>testReturnValueWithNoListeners (in category 'running-dependent value') ----- - testReturnValueWithNoListeners - - | value | - value := eventSource triggerEvent: #needsValue. - self should: [value == nil]! Item was removed: - ----- Method: EventTest>>testSingleValueSupplier (in category 'running-broadcast query') ----- - testSingleValueSupplier - - eventSource - when: #needsValue - send: #getTrue - to: self. - succeeded := eventSource triggerEvent: #needsValue. - self should: [succeeded]! Item was removed: - ----- Method: EventTest>>getTrue: (in category 'private') ----- - getTrue: anArg - - ^true! Item was removed: - ----- Method: EventTest>>getTrue (in category 'private') ----- - getTrue - - ^true! Item was removed: - ----- Method: EventTest>>testNoArgumentEventDependentSuppliedArgument (in category 'running-dependent action supplied arguments') ----- - testNoArgumentEventDependentSuppliedArgument - - eventSource when: #anEvent send: #add: to: eventListener with: 'boundValue'. - eventSource triggerEvent: #anEvent. - self should: [eventListener includes: 'boundValue']! Item was removed: - ----- Method: EventTest>>testNoValueSupplier (in category 'running-broadcast query') ----- - testNoValueSupplier - - succeeded := eventSource - triggerEvent: #needsValue - ifNotHandled: [true]. - self should: [succeeded]! Item was removed: - ----- Method: EventTest>>testNoArgumentEvent (in category 'running-dependent action') ----- - testNoArgumentEvent - - eventSource when: #anEvent send: #heardEvent to: self. - eventSource triggerEvent: #anEvent. - self should: [succeeded]! Item was removed: - ----- Method: EventTest>>testTwoArgumentEvent (in category 'running-dependent action') ----- - testTwoArgumentEvent - - eventSource when: #anEvent:info: send: #addArg1:addArg2: to: self. - eventSource triggerEvent: #anEvent:info: withArguments: #( 9 42 ). - self should: [(eventListener includes: 9) and: [eventListener includes: 42]]! Item was removed: - ----- Method: EventTest>>testReturnValueWithOneListener (in category 'running-dependent value') ----- - testReturnValueWithOneListener - - | value | - eventSource - when: #needsValue - send: #yourself - to: eventListener. - value := eventSource triggerEvent: #needsValue. - self should: [value == eventListener]! Item was removed: - ----- Method: EventTest>>getFalse (in category 'private') ----- - getFalse - - ^false! Item was removed: - ----- Method: EventTest>>setUp (in category 'running') ----- - setUp - - super setUp. - eventSource := Object new. - eventListener := Bag new. - succeeded := false! Item was removed: - TestCase subclass: #EventTest - instanceVariableNames: 'eventSource eventListener succeeded' - classVariableNames: '' - poolDictionaries: '' - category: 'System-Object Events-Tests'! Item was removed: - ----- Method: EventTest>>heardEvent (in category 'private') ----- - heardEvent - - succeeded := true! Item was removed: - ----- Method: EventTest>>testRemoveActionsTwiceForEvent (in category 'running-remove actions') ----- - testRemoveActionsTwiceForEvent - - eventSource - when: #anEvent send: #size to: eventListener; - when: #anEvent send: #getTrue to: self; - when: #anEvent: send: #fizzbin to: self. - eventSource removeActionsForEvent: #anEvent. - self assert: (eventSource hasActionForEvent: #anEvent) not. - eventSource removeActionsForEvent: #anEvent. - self assert: (eventSource hasActionForEvent: #anEvent) not.! Item was removed: - ----- Method: EventTest>>testRemoveActionsForEvent (in category 'running-remove actions') ----- - testRemoveActionsForEvent - - eventSource - when: #anEvent send: #size to: eventListener; - when: #anEvent send: #getTrue to: self; - when: #anEvent: send: #fizzbin to: self. - eventSource removeActionsForEvent: #anEvent. - self shouldnt: [eventSource hasActionForEvent: #anEvent]! Item was removed: - ----- Method: EventTest>>testMultipleValueSuppliers (in category 'running-broadcast query') ----- - testMultipleValueSuppliers - - eventSource - when: #needsValue - send: #getFalse - to: self. - eventSource - when: #needsValue - send: #getTrue - to: self. - succeeded := eventSource triggerEvent: #needsValue. - self should: [succeeded]! Item was removed: - ----- Method: EventTest>>testRemoveActionsWithReceiver (in category 'running-remove actions') ----- - testRemoveActionsWithReceiver - - | action | - eventSource - when: #anEvent send: #size to: eventListener; - when: #anEvent send: #getTrue to: self; - when: #anEvent: send: #fizzbin to: self. - eventSource removeActionsWithReceiver: self. - action := eventSource actionForEvent: #anEvent. - self assert: (action respondsTo: #receiver). - self assert: ((action receiver == self) not)! Item was removed: - ----- Method: EventTest>>testMultipleValueSuppliersEventHasArgumentsWithGC (in category 'running-broadcast query') ----- - testMultipleValueSuppliersEventHasArgumentsWithGC - - eventSource - when: #needsValue: - send: #getFalse: - to: self - with: Object new. - eventSource - when: #needsValue: - send: #getTrue: - to: self - with: Object new. - Smalltalk garbageCollectMost. - succeeded := eventSource triggerEvent: #needsValue: with: 'kolme'. - self should: [succeeded = nil] - ! Item was removed: - ----- Method: EventTest>>testMultipleValueSuppliersEventHasArguments (in category 'running-broadcast query') ----- - testMultipleValueSuppliersEventHasArguments - - eventSource - when: #needsValue: - send: #getFalse: - to: self. - eventSource - when: #needsValue: - send: #getTrue: - to: self. - succeeded := eventSource triggerEvent: #needsValue: with: 'kolme'. - self should: [succeeded]! Item was removed: - ----- Method: EventTest>>tearDown (in category 'running') ----- - tearDown - - eventSource releaseActionMap. - eventSource := nil. - eventListener := nil. - super tearDown. - ! Item was removed: - ----- Method: EventTest>>getFalse: (in category 'private') ----- - getFalse: anArg - - ^false! Item was removed: - ----- Method: EventTest>>testNoArgumentEventDependentSuppliedArguments (in category 'running-dependent action supplied arguments') ----- - testNoArgumentEventDependentSuppliedArguments - - eventSource - when: #anEvent - send: #addArg1:addArg2: - to: self - withArguments: #('hello' 'world'). - eventSource triggerEvent: #anEvent. - self should: [(eventListener includes: 'hello') and: [eventListener includes: 'world']]! |
Free forum by Nabble | Edit this page |