Patrick Rein uploaded a new version of SystemChangeNotification-Tests to project The Trunk:
http://source.squeak.org/trunk/SystemChangeNotification-Tests-pre.26.mcz ==================== Summary ==================== Name: SystemChangeNotification-Tests-pre.26 Author: pre Time: 8 August 2016, 5:51:13.361858 pm UUID: 3f06ebc7-a756-3b4b-bd7a-c00293e3493f Ancestors: SystemChangeNotification-Tests-pre.25 Fixes a test case for the system change notifications. =============== Diff against SystemChangeNotification-Tests-pre.25 =============== Item was changed: SystemChangeTestRoot subclass: #ChangeHooksTest + instanceVariableNames: 'previousChangeSet testsChangeSet capturedEvents generatedTestClass generatedTestClassX generatedTestClassC2 createdMethodName createdMethod doItExpression' - instanceVariableNames: 'previousChangeSet testsChangeSet capturedEvents generatedTestClass generatedTestClassX createdMethodName createdMethod doItExpression' classVariableNames: '' poolDictionaries: '' category: 'SystemChangeNotification-Tests'! !ChangeHooksTest commentStamp: 'bp 12/4/2009 10:37' prior: 0! This class implements unit tests to verify that when the system changes, notification messages are sent around correctly. Therefore the test messages make a system change, after registering to receive an event after the change occured. In this event (sent immediately after the change), the actual assertions take place. Note that the system changes are *really* made to the system, but in a change set that is created in the setUp method, while the previous one is restored in the tearDown method.! Item was changed: ----- Method: ChangeHooksTest>>addSingleEvent: (in category 'Private') ----- addSingleEvent: anEvent + capturedEvents isEmpty ifFalse: [self fail]. - capturedEvents isEmpty ifFalse: [self assert: false]. capturedEvents add: anEvent! Item was added: + ----- Method: ChangeHooksTest>>generateTestClassCategory2 (in category 'Private-Generation') ----- + generateTestClassCategory2 + + generatedTestClassC2 := Object + subclass: self generatedTestClassCategory2Name + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: self categoryForTestName2.! Item was added: + ----- Method: ChangeHooksTest>>generatedTestClassCategory2Name (in category 'Private-Generation') ----- + generatedTestClassCategory2Name + + ^#'AutoGeneratedClassC2ForTestingSystemChanges'! Item was changed: ----- Method: ChangeHooksTest>>setUp (in category 'Running') ----- setUp previousChangeSet := ChangeSet current. testsChangeSet := ChangeSet new. ChangeSet newChanges: testsChangeSet. capturedEvents := OrderedCollection new. self generateTestClass. self generateTestClassX. + self generateTestClassCategory2. super setUp! Item was changed: ----- Method: ChangeHooksTest>>tearDown (in category 'Running') ----- tearDown + super tearDown. self removeGeneratedTestClasses. ChangeSet newChanges: previousChangeSet. ChangesOrganizer removeChangeSet: testsChangeSet. previousChangeSet := nil. testsChangeSet := nil. capturedEvents := nil. createdMethod := nil. + SystemOrganization removeMissingClasses. "To make sure we do only try to unload recent classes." (PackageOrganizer default packages select: [:packageInfo | {self categoryForTestName1 . self categoryForTestName2} includes: packageInfo packageName ]) + do: [:packageInfo | packageInfo workingCopy unload].! - do: [:packageInfo | packageInfo workingCopy unload]. - super tearDown! Item was changed: ----- Method: ChangeHooksTest>>testClassRecategorizedEvent1 (in category 'Testing-Classes') ----- testClassRecategorizedEvent1 - Object - subclass: generatedTestClass name - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: self categoryForTestName1. self systemChangeNotifier notify: self ofAllSystemChangesUsing: #classRecategorizedEvent:. Object subclass: generatedTestClass name instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: self categoryForTestName2. self checkForOnlySingleEvent! |
Free forum by Nabble | Edit this page |