File tree Expand file tree Collapse file tree 6 files changed +61
-164
lines changed
System-Announcements-Tests Expand file tree Collapse file tree 6 files changed +61
-164
lines changed Original file line number Diff line number Diff line change @@ -334,6 +334,44 @@ AnnouncerTest >> testSubscribersForClass [
334334 self assert: subscribers size equals: 0
335335]
336336
337+ { #category : ' tests' }
338+ AnnouncerTest >> testSuspendAllWhile [
339+
340+ | value |
341+ value := 42 .
342+
343+ announcer suspendAllWhile: [
344+ announcer
345+ when: AnnouncementMockA do: [ value := value + 1 ] for: self ;
346+ announce: AnnouncementMockA ].
347+
348+ self assert: value equals: 42 . " The answer is always 42 :)"
349+
350+ announcer announce: AnnouncementMockA .
351+
352+ self assert: value equals: 43
353+ ]
354+
355+ { #category : ' tests' }
356+ AnnouncerTest >> testSuspendAllWhileStoring [
357+
358+ | stored |
359+ stored := announcer suspendAllWhileStoring: [ announcer announce: AnnouncementMockA ].
360+
361+ self assert: stored size equals: 1 .
362+ self assert: (stored at: 1 ) equals: AnnouncementMockA
363+ ]
364+
365+ { #category : ' tests' }
366+ AnnouncerTest >> testSuspendAllWhileStoringNested [
367+
368+ | stored |
369+ stored := announcer suspendAllWhileStoring: [ announcer suspendAllWhileStoring: [ announcer announce: AnnouncementMockA ] ].
370+
371+ self assert: stored size equals: 1 .
372+ self assert: (stored at: 1 ) equals: AnnouncementMockA
373+ ]
374+
337375{ #category : ' tests' }
338376AnnouncerTest >> testSymbolIdentifier [
339377 | passed |
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ BaselineOfBasicTools >> baseline: spec [
7575 package: ' Monticello-GUI-Diff'
7676 with: [ spec requires: #( 'Tool-Diff' 'MonticelloGUI' ) ].
7777 spec package: ' System-Sources-Tests' . " <= Not sure this one should be here but it is where the classes were loaded before been extracted from Tests package."
78- spec package: ' System-Announcements-Tests ' . " <= Not sure this one should be here but it is where the classes were loaded before been extracted from Tests package. "
78+
7979 spec package: ' Kernel-CodeModel-Tests' .
8080 spec package: ' Monticello-Tests' .
8181 spec package: ' MonticelloGUI-Tests' .
Original file line number Diff line number Diff line change @@ -289,6 +289,18 @@ ReleaseTest >> testMethodsContainNoHalt [
289289 print: methods ] ]
290290]
291291
292+ { #category : ' tests - announcer' }
293+ ReleaseTest >> testNoDeadSubscriptions [
294+
295+ | dead |
296+ " we skiped this on the ci in the past: https://github.com/pharo-project/pharo/issues/2471"
297+ 3 timesRepeat: [ Smalltalk garbageCollect ].
298+
299+ dead := self class codeChangeAnnouncer subscriptions subscriptions select: [ :sub | sub subscriber isNil ].
300+
301+ self assert: dead asArray equals: #( )
302+ ]
303+
292304{ #category : ' tests' }
293305ReleaseTest >> testNoEmptyPackages [
294306 " Test that we have no empty packages left"
@@ -415,6 +427,16 @@ ReleaseTest >> testObsoleteClasses [
415427 print: obsoleteClasses ]]
416428]
417429
430+ { #category : ' tests - announcer' }
431+ ReleaseTest >> testOnlyWeakSubscriptions [
432+
433+ | strong |
434+ " only weak subscriptions should be allowed to be added to the SystemAnnouncer..."
435+ strong := self class codeChangeAnnouncer subscriptions subscriptions reject: [ :each | each isKindOf: WeakAnnouncementSubscription ].
436+
437+ self assert: strong asArray equals: #( )
438+ ]
439+
418440{ #category : ' tests - package' }
419441ReleaseTest >> testPackageOrganizer [
420442 " Ensure other tests temporary created organizers are collected"
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments