pharo-graphics / Bloc

Low-level UI infrastructure & framework for Pharo
MIT License
83 stars 40 forks source link

Fix 4 tests on Pharo 13 #550

Open tinchodias opened 4 months ago

tinchodias commented 4 months ago

Errors from CI:

#########################
# 4 tests did not pass: #
#########################

BlDemoBasicNodeTest
 ✗ #testOnePackageWithTwoClassesHasTwoNodesWithSample2 (2ms)
UndeclaredVariableRead: Attempt to read undeclared variable RPackageOrganizer
UndeclaredVariable>>runtimeUndeclaredReadInContext:
BlDemoBasicNodeTest>>testOnePackageWithTwoClassesHasTwoNodesWithSample2 ...RPackageOrganizer
BlDemoBasicNodeTest(TestCase)>>performTest
 ✗ #testOnePackageWithTwoClassesHasTwoNodes (2ms)
UndeclaredVariableRead: Attempt to read undeclared variable RPackageOrganizer
UndeclaredVariable>>runtimeUndeclaredReadInContext:
BlDemoBasicNodeTest>>testOnePackageWithTwoClassesHasTwoNodes ...RPackageOrganizer
BlDemoBasicNodeTest(TestCase)>>performTest

BlRopedTextTest2
 ✗ #testInsertEmptyStrings (5ms)
Instance of BlTextAnnouncer did not understand #when:do:
BlTextAnnouncer(Object)>>doesNotUnderstand: #when:do:
BlRopedText(BlText)>>when:do:
BlRopedTextTest2>>testInsertEmptyStrings ...when: BlTextStringsInserted
        do: [ :anAnnouncement | insertedStrings := anAnnouncement strings ]
BlRopedTextTest2(TestCase)>>performTest
 ✗ #testAppendEmptyText (1ms)
Instance of BlTextAnnouncer did not understand #when:do:
BlTextAnnouncer(Object)>>doesNotUnderstand: #when:do:
BlRopedText(BlText)>>when:do:
BlRopedTextTest2>>testAppendEmptyText ...when: BlTextStringsInserted
        do: [ wasAnnounced := wasAnnounced + 1 ]
BlRopedTextTest2(TestCase)>>performTest
tinchodias commented 4 months ago

I'm looking for the equivalent in P13 of (RPackageOrganizer default packageNamed: #'Bloc-Demo') to fix 2 tests in BlDemoBasicNodeTest.

@jecisc do you know?

tinchodias commented 4 months ago

Another occurrence:

BlDemoPresenter>>
packagesToCollect
    ^ RPackageOrganizer default packages select: [ :each |
          each name includesSubstring: 'Bloc' ]
jecisc commented 4 months ago

You can access the package organizer of a class through #packageOrganizer method now :) Instead of referencing a global

jecisc commented 4 months ago

If your project need to also work in P11 you can take a look at this project: https://github.com/jecisc/PharoBackwardCompatibility

jecisc commented 4 months ago

Another occurrence:

BlDemoPresenter>>
packagesToCollect
  ^ RPackageOrganizer default packages select: [ :each |
        each name includesSubstring: 'Bloc' ]

This can become

BlDemoPresenter>>packagesToCollect
    ^ self packageOrganizer packages select: [ :package | package name includesSubstring: 'Bloc' ]
tinchodias commented 4 months ago

Thanks @jecisc ! Yes, I like the deprecation and new way to to it. To make it work from p11 to p13, I'm replacing by self class packageOrganizer. Because packageOrganizer doesn't belong to Object in P11 but it does in ClassDescription

jecisc commented 4 months ago

It's also another possibility.

If there are more cases you can check my PharoBackwardCompatibility project and I can add more API to it.

The idea is to add in older Pharo versions, API from newer versions. Like this, we can use the new API without worrying that older versions will not know them.

tinchodias commented 4 months ago

The cause of the remaining 2 failing tests are what is reported in #433