Nicolas Cellier uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-nice.450.mcz ==================== Summary ==================== Name: Tests-nice.450 Author: nice Time: 13 April 2021, 6:32:38.49942 pm UUID: 88d71628-1262-524d-bbc0-7489c23848f3 Ancestors: Tests-mt.449 Revises ExceptionTests >> #testCatchingDefaultAction to work when being debugged/simulated as well. This also decouples the test from the implementation details of UnhandledWarnings. Also, Warning may be entirely disabled by a Preference, making the test fail. Removes #testHandlerFromAction from expectedFailures because it now finally works. This is same as Tests-ct.448 and Tests-ct.449, with a slightly different test, such that the defaultAction is triggered. Thanks Christoph! =============== Diff against Tests-mt.449 =============== Item was removed: - ----- Method: ExceptionTests>>expectedFailures (in category 'failures') ----- - expectedFailures - "This test is a feature request. For more information on this issue visit: - http://forum.world.st/The-Inbox-Tests-TestRunner-156-mcz-tc4643910.html#a4643987 - http://forum.world.st/ExceptionTests-Wrong-error-handler-tc4848699.html - http://forum.world.st/ExceptionTests-gt-testHandlerFromAction-fails-tc4872828.html#a4872958" - - ^ #(testHandlerFromAction).! Item was changed: ----- Method: ExceptionTests>>testCatchingDefaultAction (in category 'tests - outer') ----- testCatchingDefaultAction "The #defaultAction method is executed in the context of the signaling environment. + It must thus be caught by the handler." + - The defaultAction will raise an UnhandledWarning that should be caught by this handler." | result | + result := [MyTestNotification signalForAction: [MyTestError signal: '2nd exception']] + on: MyTestError + do: [:ex | '2nd exception caught']. + self assert: '2nd exception caught' equals: result.! - result := [ Warning signal: 'Warning signalled' ] on: UnhandledWarning do: [ :ex | 'UnhandledWarning caught' ]. - self assert: 'UnhandledWarning caught' equals: result! Item was changed: Notification subclass: #MyTestNotification + instanceVariableNames: 'action' - instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Tests-Exceptions'! Item was added: + ----- Method: MyTestNotification class>>signalForAction: (in category 'signaling') ----- + signalForAction: aBlock + + ^ self new + action: aBlock; + signal! Item was added: + ----- Method: MyTestNotification>>action (in category 'accessing') ----- + action + + ^ action! Item was added: + ----- Method: MyTestNotification>>action: (in category 'accessing') ----- + action: aBlock + + action := aBlock! Item was added: + ----- Method: MyTestNotification>>defaultAction (in category 'priv handling') ----- + defaultAction + + self action ifNotNil: [^ self action cull: self]. + + ^ super defaultAction! |
Yes, you're right with the MyTestError, of course. Thanks for merging this and all the other recent stuff!! :-)
Best, Christoph Von: Squeak-dev <[hidden email]> im Auftrag von [hidden email] <[hidden email]>
Gesendet: Dienstag, 13. April 2021 18:32:45 An: [hidden email]; [hidden email] Betreff: [squeak-dev] The Trunk: Tests-nice.450.mcz Nicolas Cellier uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-nice.450.mcz ==================== Summary ==================== Name: Tests-nice.450 Author: nice Time: 13 April 2021, 6:32:38.49942 pm UUID: 88d71628-1262-524d-bbc0-7489c23848f3 Ancestors: Tests-mt.449 Revises ExceptionTests >> #testCatchingDefaultAction to work when being debugged/simulated as well. This also decouples the test from the implementation details of UnhandledWarnings. Also, Warning may be entirely disabled by a Preference, making the test fail. Removes #testHandlerFromAction from expectedFailures because it now finally works. This is same as Tests-ct.448 and Tests-ct.449, with a slightly different test, such that the defaultAction is triggered. Thanks Christoph! =============== Diff against Tests-mt.449 =============== Item was removed: - ----- Method: ExceptionTests>>expectedFailures (in category 'failures') ----- - expectedFailures - "This test is a feature request. For more information on this issue visit: - http://forum.world.st/The-Inbox-Tests-TestRunner-156-mcz-tc4643910.html#a4643987 - http://forum.world.st/ExceptionTests-Wrong-error-handler-tc4848699.html - http://forum.world.st/ExceptionTests-gt-testHandlerFromAction-fails-tc4872828.html#a4872958" - - ^ #(testHandlerFromAction).! Item was changed: ----- Method: ExceptionTests>>testCatchingDefaultAction (in category 'tests - outer') ----- testCatchingDefaultAction "The #defaultAction method is executed in the context of the signaling environment. + It must thus be caught by the handler." + - The defaultAction will raise an UnhandledWarning that should be caught by this handler." | result | + result := [MyTestNotification signalForAction: [MyTestError signal: '2nd exception']] + on: MyTestError + do: [:ex | '2nd exception caught']. + self assert: '2nd exception caught' equals: result.! - result := [ Warning signal: 'Warning signalled' ] on: UnhandledWarning do: [ :ex | 'UnhandledWarning caught' ]. - self assert: 'UnhandledWarning caught' equals: result! Item was changed: Notification subclass: #MyTestNotification + instanceVariableNames: 'action' - instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Tests-Exceptions'! Item was added: + ----- Method: MyTestNotification class>>signalForAction: (in category 'signaling') ----- + signalForAction: aBlock + + ^ self new + action: aBlock; + signal! Item was added: + ----- Method: MyTestNotification>>action (in category 'accessing') ----- + action + + ^ action! Item was added: + ----- Method: MyTestNotification>>action: (in category 'accessing') ----- + action: aBlock + + action := aBlock! Item was added: + ----- Method: MyTestNotification>>defaultAction (in category 'priv handling') ----- + defaultAction + + self action ifNotNil: [^ self action cull: self]. + + ^ super defaultAction!
Carpe Squeak!
|
Free forum by Nabble | Edit this page |