Levente Uzonyi uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-ul.319.mcz ==================== Summary ==================== Name: Tests-ul.319 Author: ul Time: 6 May 2015, 6:03:36.809 pm UUID: d83e9ef7-c5df-441a-938e-a5ccb76827a7 Ancestors: Tests-ul.318 Actualized the list in DecompilerTests >> #decompilerFailures. Refactored DecompilerTests and DecompilerTestFailuresCollector: the class of the exception is noted and verified. =============== Diff against Tests-ul.318 =============== Item was changed: ----- Method: DecompilerTestFailuresCollector>>assert:description:resumable: (in category 'accessing') ----- + assert: aBoolean description: aString resumable: resumableBoolean + + | method | + aBoolean ifTrue: [ ^self ]. + method := thisContext sender home tempAt: 1. + self noteFailure: TestFailure for: method! - assert: aBoolean description: aString resumable: resumableBoolean - aBoolean ifFalse: - [failures isNil ifTrue: - [failures := OrderedCollection new]. - failures addLast: (thisContext sender home tempAt: 1) methodReference]! Item was changed: ----- Method: DecompilerTestFailuresCollector>>checkDecompileMethod: (in category 'utilities') ----- checkDecompileMethod: oldMethod + [ super checkDecompileMethod: oldMethod ] + on: Error + do: [ :error | self noteFailure: error class for: oldMethod ]! - [^super checkDecompileMethod: oldMethod] - on: SyntaxErrorNotification - do: [:ex| - self assert: false - description: 'syntax error' - resumable: true].! Item was changed: ----- Method: DecompilerTestFailuresCollector>>computeFailures (in category 'accessing') ----- computeFailures + + | tests | + failures := nil. + tests := (DecompilerTests organization listAtCategoryNamed: #tests) select: [ :s | + (s beginsWith: 'testDecompilerInClasses') ]. + CurrentReadOnlySourceFiles cacheDuring: [ + tests + do: [ :each | self perform: each ] + displayingProgress: 'Computing failures...' ]. + ^self decompilerFailures! - (DecompilerTests organization listAtCategoryNamed: #tests) do: - [:s| - (s beginsWith: 'testDecompilerInClasses') ifTrue: - [self perform: s]]. - ^failures! Item was added: + ----- Method: DecompilerTestFailuresCollector>>decompilerFailures (in category 'accessing') ----- + decompilerFailures + + failures ifNil: [ ^#() ]. + ^failures asArray sort: [ :a :b | + | r | + r := a first compare: b first caseSensitive: false. + r = 1 or: [ r = 2 and: [ + (a second compare: b second caseSensitive: false) <= 2 ] ] ]! Item was added: + ----- Method: DecompilerTestFailuresCollector>>errorClassForFailureFor:selector: (in category 'accessing') ----- + errorClassForFailureFor: class selector: selector + + ^nil! Item was added: + ----- Method: DecompilerTestFailuresCollector>>exceptionClassForFailureFor:selector: (in category 'utilities') ----- + exceptionClassForFailureFor: class selector: selector + + ^nil! Item was removed: - ----- Method: DecompilerTestFailuresCollector>>isFailure:sel: (in category 'accessing') ----- - isFailure: cls sel: selector - ^false! Item was added: + ----- Method: DecompilerTestFailuresCollector>>noteFailure:for: (in category 'utilities') ----- + noteFailure: exceptionClass for: method + + (failures ifNil: [ failures := OrderedCollection new ]) add: { + method methodClass name. + method selector. + exceptionClass name }! Item was changed: ----- Method: DecompilerTests>>decompileClassesSelect: (in category 'utilities') ----- decompileClassesSelect: aBlock CurrentReadOnlySourceFiles cacheDuring: [ + (self classNames select: aBlock) do: [ :cn | + | class | + (class := Smalltalk classNamed: cn) selectorsAndMethodsDo: [ :selector :method | + (self exceptionClassForFailureFor: class selector: selector) + ifNil: [ self checkDecompileMethod: method ] + ifNotNil: [ :exceptionClass | + self + should: [ self checkDecompileMethod: method ] + raise: exceptionClass ] ] ] ]! - (self classNames select: aBlock) do: - [:cn | | cls | - cls := Smalltalk globals at: cn. - cls selectorsAndMethodsDo: - [:selector :meth | - (self isFailure: cls sel: selector) ifFalse: - [self checkDecompileMethod: meth]]]]! Item was changed: ----- Method: DecompilerTests>>decompilerFailures (in category 'utilities') ----- decompilerFailures "Here is the list of failures: either a syntax error, a hard error or some failure to decompile correctly. + Collected via + DecompilerTestFailuresCollector new computeFailures." - Collected via - CurrentReadOnlySourceFiles cacheDuring: [ - (DecompilerTestFailuresCollector new computeFailures collect: - [:mr| { mr classSymbol. mr selector }]) asArray ]." + "class name, selector, error class name or nil" + ^#( (Behavior toolIconSelector: TestFailure) + (BrowserCommentTextMorph showPane SyntaxErrorNotification) + (ClassDescription replaceSilently:to: SyntaxErrorNotification) + (CodeHolder getSelectorAndSendQuery:to:with: SyntaxErrorNotification) + (Date printOn: TestFailure) + (DecompilerTests testDecompileUnreachableParameter Error) + (FontImporterTool fontFromFamily: SyntaxErrorNotification) "same-name block-local temps in optimized blocks" + (HttpUrl checkAuthorization:retry: TestFailure) + (LargeNegativeIntegerTest testReplaceFromToWithStartingAt SyntaxErrorNotification) "same-name block-local temps in optimized blocks" + (LargePositiveIntegerTest testReplaceFromToWithStartingAt SyntaxErrorNotification) "same-name block-local temps in optimized blocks" + (MailComposition breakLinesInMessage: SyntaxErrorNotification) + (MCConfigurationBrowser post SyntaxErrorNotification) + (MVCToolBuilder setLayout:in: SyntaxErrorNotification) "same-name block-local temps in optimized blocks" + (ParagraphEditor inOutdent:delta: SyntaxErrorNotification) + (PNGReadWriter copyPixelsGray: SyntaxErrorNotification) + (PointTest testNormal TestFailure) "fraction printing??" + (PointTest testTheta TestFailure) "fraction printing??" + (ScaledDecimalTest testConvertFromFraction SyntaxErrorNotification) "local/non-local temps" + (SHMCClassDefinition withAllSuperclassesDo: SyntaxErrorNotification) "same-name block-local temps in optimized blocks" + (StandardScriptingSystem holderWithAlphabet SyntaxErrorNotification) "same-name block-local temps in optimized blocks" + (SystemWindow convertAlignment SyntaxErrorNotification) + (TextEditor inOutdent:delta: SyntaxErrorNotification) + (TextURL actOnClickFor: TestFailure) + (TTContourConstruction segmentsDo: SyntaxErrorNotification) "Worth fixing; these two are mistaken conversion from a whileTrue: to a to:do: but the index is used outside the whileTrue:" + (TTFontReader processHorizontalMetricsTable:length: SyntaxErrorNotification))! - ^#( (Behavior toolIconSelector:) - (BrowserCommentTextMorph showPane) - (ClassDescription replaceSilently:to:) - (CodeHolder getSelectorAndSendQuery:to:with:) - (Date printOn:) - (DecompilerTests testDecompileUnreachableParameter) - (HttpUrl checkAuthorization:retry:) - (MCConfigurationBrowser post) - (MailComposition breakLinesInMessage:) - (MVCToolBuilder setLayout:in:) "same-name block-local temps in optimized blocks" - (ParagraphEditor inOutdent:delta:) - (PNGReadWriter copyPixelsGray:) - (PointTest testNormal) "fraction printing??" - (PointTest testTheta) "fraction printing??" - (ScaledDecimalTest testConvertFromFraction) "local/non-local temps" - (StandardScriptingSystem holderWithAlphabet) "same-name block-local temps in optimized blocks" - (SystemWindow convertAlignment) - (TextEditor inOutdent:delta:) - (TextURL actOnClickFor:) - (TTContourConstruction segmentsDo:) "Worth fixing; these two are mistaken conversion from a whileTrue: to a to:do: but the index is used outside the whileTrue:" - (TTFontReader processHorizontalMetricsTable:length:))! Item was added: + ----- Method: DecompilerTests>>exceptionClassForFailureFor:selector: (in category 'utilities') ----- + exceptionClassForFailureFor: class selector: selector + + ^self decompilerFailures + detect: [ :each | each first = class name and: [ each second = selector ] ] + ifFound: [ :each | each third ifNotNil: [ Smalltalk classNamed: each third ] ] + ifNone: [ nil ]! Item was removed: - ----- Method: DecompilerTests>>isFailure:sel: (in category 'utilities') ----- - isFailure: cls sel: selector - "self new isKnowProblem: PNMReaderWriter sel: #nextImage" - "#((PNMReadWriter nextImage)) includes: {PNMReadWriter - name asSymbol . #nextImage}." - ^(#(#DoIt #DoItIn:) includes: selector) - or: [self decompilerFailures includes: {cls name asSymbol. selector}]! |
Free forum by Nabble | Edit this page |