pharo-project / pharo

Pharo is a dynamic reflective pure object-oriented language supporting live programming inspired by Smalltalk.
http://pharo.org
Other
1.21k stars 356 forks source link

testUndeclared log is getting crazy.... #17329

Open Ducasse opened 3 weeks ago

Ducasse commented 3 weeks ago

Here is what I get when I run the integration tests of microdown.

https://github.com/pillar-markup/Microdown/actions/workflows/tests-all.yml

#########################
# 2 tests did not pass: #
#########################

ReleaseTest
 ✗ #testUndeclared (151ms)
CollectionIsEmpty: a WeakIdentitySet() is empty
WeakIdentitySet(Collection)>>errorEmptyCollection
WeakIdentitySet(Collection)>>emptyCheck
WeakIdentitySet(Collection)>>anyOne
WeakIdentitySet(WeakSet)>>anyOne
[ :variable |
                           | method |
                           method := variable usingMethods anyOne.
                           stream cr
                               nextPutAll: variable name;
                               nextPutAll: ' in: ';
                               print: method methodClass;
                               nextPutAll: '>>';
                               print: method selector ] in [ :stream |
                       stream nextPutAll: 'Found undeclared Variables: '.
                       remaining do: [ :variable |
                           | method |
                           method := variable usingMethods anyOne.
                           stream cr
                               nextPutAll: variable name;
                               nextPutAll: ' in: ';
                               print: method methodClass;
                               nextPutAll: '>>';
                               print: method selector ] ] in [ "we compile a second method with the undeclared #undeclaredStubInstVar1 to trigger the code path of removing twice in #cleanOutUndeclared"
    self class compile: 'methodForTest ^undeclaredStubInstVar1'.
    Smalltalk cleanOutUndeclared.
    undeclaredVariables := Undeclared associations select: [ :each | each isUndeclaredVariable ].

    validExceptions := { #undeclaredStubInstVar1. #undeclaredStubInstVar2. #Gofer }. "The laste one is for Smalltalk CI and our external projects... But we should find a better solution at some point."

    "for now we filter by name, maybe filtering by variable would be better"
    remaining := undeclaredVariables reject: [ :each | validExceptions includes: each name ].

    "we look for one of the using methods of the undeclared var and report that,
    this should be enough to fix it quickly"
    description := String streamContents: [ :stream |
                       stream nextPutAll: 'Found undeclared Variables: '.
                       remaining do: [ :variable |
                           | method |
                           method := variable usingMethods anyOne.
                           stream cr
                               nextPutAll: variable name;
                               nextPutAll: ' in: ';
                               print: method methodClass;
                               nextPutAll: '>>';
                               print: method selector ] ].

    self assert: remaining isEmpty description: description ] in ReleaseTest>>testUndeclared ...anyOne
Array(SequenceableCollection)>>do:
[ :stream |
                       stream nextPutAll: 'Found undeclared Variables: '.
                       remaining do: [ :variable |
                           | method |
                           method := variable usingMethods anyOne.
                           stream cr
                               nextPutAll: variable name;
    description := String streamContents: [ :stream |
                       stream nextPutAll: 'Found undeclared Variables: '.
                       remaining do: [ :variable |
                           | method |
                           method := variable usingMethods anyOne.
                           stream cr
                               nextPutAll: variable name;
                               nextPutAll: ' in: ';
                               print: method methodClass;
                               nextPutAll: '>>';
                               print: method selector ] ].

    self assert: remaining isEmpty description: description ] in ReleaseTest>>testUndeclared ...streamContents: [ :stream |
                       stream nextPutAll: 'Found undeclared Variables: '.
                       remaining do: [ :variable |
                           | method |
                           method := variable usingMethods anyOne.
                           stream cr
                               nextPutAll: variable name;
                               nextPutAll: ' in: ';
                               print: method methodClass;
                               nextPutAll: '>>';
                               print: method selector ] ]
FullBlockClosure(BlockClosure)>>ensure:
ReleaseTest>>testUndeclared ...ensure: [ self class removeSelector: #methodForTest ]
ReleaseTest(TestCase)>>performTest
 ✗ #testObsoleteClasses (831ms)
TestFailure: Obsolete classes remaining: an Array(AnObsoleteMicResourceReference AnObsoleteMicAbsoluteResourceReference AnObsoleteMicHTTPResourceReference AnObsoleteMicPharoImageResourceReference AnObsoleteMicrodownVisitor AnObsoleteMicArgumentList AnObsoleteMicMicrodownSharedPool AnObsoleteMicAbstractDelimiter AnObsoleteMicAnchorReferenceCloserDelimiter AnObsoleteMicAnchorReferenceOpenerDelimiter AnObsoleteMicAnnotationCloserDelimiter AnObsoleteMicAnnotationOpenerDelimiter AnObsoleteMicBoldDelimiter AnObsoleteMicFigureNameOpenerDelimiter AnObsoleteMicItalicDelimiter AnObsoleteMicLinkNameDelimiter AnObsoleteMicLinkNameCloserDelimiter AnObsoleteMicLinkNameOpenerDelimiter AnObsoleteMicMathDelimiter AnObsoleteMicMonospaceDelimiter AnObsoleteMicRawCloserDelimiter AnObsoleteMicRawOpenerDelimiter AnObsoleteMicStrikeDelimiter AnObsoleteMicElement AnObsoleteMicAbstractBlock AnObsoleteMicAbstractAnnotatedBlock AnObsoleteMicAnnotatedBlock AnObsoleteMicContinuousMarkedBlock AnObsoleteMicCommentBlock AnObsoleteMicQuoteBlock AnObsoleteMicTableBlock AnObsoleteMicListBlock AnObsoleteMicOrderedListBlock AnObsoleteMicUnorderedListBlock AnObsoleteMicListItemBlock AnObsoleteMicParagraphBlock AnObsoleteMicRootBlock AnObsoleteMicSingleLineBlock AnObsoleteMicAnchorBlock AnObsoleteMicHeaderBlock AnObsoleteMicHorizontalLineBlock AnObsoleteMicStartStopMarkupBlock AnObsoleteMicEnvironmentBlock AnObsoleteMicMetaDataBlock AnObsoleteMicSameStartStopMarkupBlock AnObsoleteMicAbstractCodeBlock AnObsoleteMicScriptBlock AnObsoleteMicPharoEvaluatorBlock AnObsoleteMicMathBlock AnObsoleteMicInlineElement AnObsoleteMicAnnotationBlock AnObsoleteMicInlineBlockWithUrl AnObsoleteMicFigureBlock AnObsoleteMicLinkBlock AnObsoleteMicTextBlock AnObsoleteMicInlineParser AnObsoleteMicrodownParser AnObsoleteMicRichTextBrush AnObsoleteMicRichTextIndentBrush AnObsoleteMicRichTextCanvas AnObsoleteMicRichTextCodeBlockStyler AnObsoleteMicTextStyler AnObsoleteMicRichTextComposer AnObsoleteMicRichTextDoIt AnObsoleteMicMorphicTextAdapter AnObsoleteMicMorphicMicrodownAdapter AnObsoleteMicScrolledTextMorph)
ReleaseTest(TestAsserter)>>assert:description:resumable:
ReleaseTest(TestAsserter)>>assert:description:
ReleaseTest>>testObsoleteClasses ...assert: obsoleteClasses isEmpty
        description: [
            String streamContents: [ :s|
                s
                    nextPutAll: 'Obsolete classes remaining: ';
                    print: obsoleteClasses ]]
ReleaseTest(TestCase)>>performTest

###########
# Summary #
###########

ReleaseTest
 ✗ #testUndeclared (151ms)
 ✗ #testObsoleteClasses (831ms)

  Executed 765 Tests with 1 Failures and 1 Errors in 62.56s.