Eliot Miranda uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-eem.392.mcz ==================== Summary ==================== Name: Tests-eem.392 Author: eem Time: 11 January 2018, 9:28:59.509687 am UUID: 3d7fbbfa-ba3e-4910-997a-7fb58b135360 Ancestors: Tests-eem.391 Update some tests to suit the recent full blocks changes. =============== Diff against Tests-eem.391 =============== Item was added: + ----- Method: ClosureCompilerTest>>bytecodeSetClassesForTests (in category 'support') ----- + bytecodeSetClassesForTests + ^#(EncoderForV3PlusClosures EncoderForSistaV1) + collect: [:name| Smalltalk classNamed: name] + thenSelect: [:classOrNil| classOrNil notNil]! Item was changed: ----- Method: ClosureCompilerTest>>testBlockNumbering (in category 'tests') ----- testBlockNumbering "Test that the compiler and CompiledMethod agree on the block numbering of a substantial doit." "self new testBlockNumbering" + + self bytecodeSetClassesForTests do: + [:class| | methodNode method tempRefs | + methodNode := + Parser new + encoderClass: EncoderForV3PlusClosures; + parse: 'foo + | numCopiedValuesCounts | + numCopiedValuesCounts := Dictionary new. + 0 to: 32 do: [:i| numCopiedValuesCounts at: i put: 0]. + Transcript clear. + Smalltalk allClasses remove: GeniePlugin; do: + [:c| + {c. c class} do: + [:b| + Transcript nextPut: b name first; endEntry. + b selectorsAndMethodsDo: + [:s :m| | pn | + m isQuick not ifTrue: + [pn := b parserClass new + encoderClass: EncoderForV3PlusClosures; + parse: (b sourceCodeAt: s) + class: b. + pn generate. + [pn accept: nil] + on: MessageNotUnderstood + do: [:ex| | msg numCopied | + msg := ex message. + (msg selector == #visitBlockNode: + and: [(msg argument instVarNamed: ''optimized'') not]) ifTrue: + [numCopied := (msg argument computeCopiedValues: pn) size. + numCopiedValuesCounts + at: numCopied + put: (numCopiedValuesCounts at: numCopied) + 1]. + msg setSelector: #==. + ex resume: nil]]]]]. + numCopiedValuesCounts' + class: Object. + method := methodNode generate. + tempRefs := methodNode encoder blockExtentsToTempsMap. + self assert: tempRefs keys asSet equals: method startKeysToBlockExtents values asSet]! - | methodNode method tempRefs | - methodNode := - Parser new - encoderClass: EncoderForV3PlusClosures; - parse: 'foo - | numCopiedValuesCounts | - numCopiedValuesCounts := Dictionary new. - 0 to: 32 do: [:i| numCopiedValuesCounts at: i put: 0]. - Transcript clear. - Smalltalk allClasses remove: GeniePlugin; do: - [:c| - {c. c class} do: - [:b| - Transcript nextPut: b name first; endEntry. - b selectorsAndMethodsDo: - [:s :m| | pn | - m isQuick not ifTrue: - [pn := b parserClass new - encoderClass: EncoderForV3PlusClosures; - parse: (b sourceCodeAt: s) - class: b. - pn generate. - [pn accept: nil] - on: MessageNotUnderstood - do: [:ex| | msg numCopied | - msg := ex message. - (msg selector == #visitBlockNode: - and: [(msg argument instVarNamed: ''optimized'') not]) ifTrue: - [numCopied := (msg argument computeCopiedValues: pn) size. - numCopiedValuesCounts - at: numCopied - put: (numCopiedValuesCounts at: numCopied) + 1]. - msg setSelector: #==. - ex resume: nil]]]]]. - numCopiedValuesCounts' - class: Object. - method := methodNode generate. - tempRefs := methodNode encoder blockExtentsToTempsMap. - self assert: tempRefs keys asSet = method startpcsToBlockExtents values asSet! Item was changed: ----- Method: ClosureCompilerTest>>testBlockNumberingForInjectInto (in category 'tests') ----- testBlockNumberingForInjectInto "Test that the compiler and CompiledMethod agree on the block numbering of Collection>>inject:into: and that temp names for inject:into: are recorded." "self new testBlockNumberingForInjectInto" + self bytecodeSetClassesForTests do: + [:class| | methodNode method tempRefs | + methodNode := Parser new + encoderClass: EncoderForV3PlusClosures; + parse: (Collection sourceCodeAt: #inject:into:) + class: Collection. + method := methodNode generate. + tempRefs := methodNode encoder blockExtentsToTempsMap. + self assert: tempRefs keys asSet equals: method startKeysToBlockExtents values asSet. + self assert: ((tempRefs includesKey: (0 to: 6)) + and: [(tempRefs at: (0 to: 6)) hasEqualElements: #(('thisValue' 1) ('binaryBlock' 2) ('nextValue' (3 1)))]). + self assert: ((tempRefs includesKey: (2 to: 4)) + and: [(tempRefs at: (2 to: 4)) hasEqualElements: #(('each' 1) ('binaryBlock' 2) ('nextValue' (3 1)))])]! - | methodNode method tempRefs | - methodNode := Parser new - encoderClass: EncoderForV3PlusClosures; - parse: (Collection sourceCodeAt: #inject:into:) - class: Collection. - method := methodNode generate. - tempRefs := methodNode encoder blockExtentsToTempsMap. - self assert: tempRefs keys asSet = method startpcsToBlockExtents values asSet. - self assert: ((tempRefs includesKey: (0 to: 6)) - and: [(tempRefs at: (0 to: 6)) hasEqualElements: #(('thisValue' 1) ('binaryBlock' 2) ('nextValue' (3 1)))]). - self assert: ((tempRefs includesKey: (2 to: 4)) - and: [(tempRefs at: (2 to: 4)) hasEqualElements: #(('each' 1) ('binaryBlock' 2) ('nextValue' (3 1)))])! Item was changed: ----- Method: MethodHighlightingTests>>testMethodHighlighting (in category 'tests') ----- testMethodHighlighting | map before after method retpc | "Test the highlighting of the asXML method. Test the highlighting of the return statement which should include the whole block supplied to streamContents:." "DebuggerMethodMap voidMapCache" "DebuggerMethodMap forMethod: MethodHighlightingTests >> #asXML" method := MethodHighlightingTests >> #asXML. map := DebuggerMethodMap forMethod: method. retpc := method endPC. + before := map rangeForPC: retpc in: method contextIsActiveContext: false. - before := map rangeForPC: retpc contextIsActiveContext: false. map instVarNamed: 'abstractSourceRanges' put: nil. + after := map rangeForPC: retpc in: method contextIsActiveContext: false. - after := map rangeForPC: retpc contextIsActiveContext: false. self assert: before size > 500. self assert: before = after! |
Free forum by Nabble | Edit this page |