Skip to content

Commit b2b94cc

Browse files
authored
Merge pull request #16503 from jecisc/misc/improve-tests
Clean System-Announcements-Tests
2 parents f824aba + 1455ae9 commit b2b94cc

File tree

6 files changed

+61
-164
lines changed

6 files changed

+61
-164
lines changed

src/Announcements-Core-Tests/AnnouncerTest.class.st

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff 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' }
338376
AnnouncerTest >> testSymbolIdentifier [
339377
| passed |

src/BaselineOfBasicTools/BaselineOfBasicTools.class.st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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'.

src/ReleaseTests/ReleaseTest.class.st

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff 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' }
293305
ReleaseTest >> 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' }
419441
ReleaseTest >> testPackageOrganizer [
420442
"Ensure other tests temporary created organizers are collected"

src/System-Announcements-Tests/SystemAnnouncerLiveTest.class.st

Lines changed: 0 additions & 49 deletions
This file was deleted.

src/System-Announcements-Tests/SystemAnnouncerTest.class.st

Lines changed: 0 additions & 113 deletions
This file was deleted.

src/System-Announcements-Tests/package.st

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)