The Inbox: ToolsTests-ct.95.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: ToolsTests-ct.95.mcz

commits-2
Christoph Thiede uploaded a new version of ToolsTests to project The Inbox:
http://source.squeak.org/inbox/ToolsTests-ct.95.mcz

==================== Summary ====================

Name: ToolsTests-ct.95
Author: ct
Time: 7 March 2020, 5:53:11.899194 pm
UUID: cb84b883-5550-b842-b9b1-49eaade84d63
Ancestors: ToolsTests-mt.94

Tests method highlighting. Complements Tools-ct.957.

Please note that this test case originally was named MethodHighlightingTests and was located in Tests-Compiler. I think it actually belongs into the ToolsTests package rather. If you agree to move the test, we also need to remove it in Tests-Compiler.

=============== Diff against ToolsTests-mt.94 ===============

Item was added:
+ TestCase subclass: #DebuggerMethodMapTests
+ instanceVariableNames: 'creator timeStamp duration tracks'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'ToolsTests-Debugger'!

Item was added:
+ ----- Method: DebuggerMethodMapTests>>asXML (in category 'fixtures') -----
+ asXML
+ "self new asXML"
+ "Convert the master index into external XML representation"
+
+ ^String streamContents:[:s| | writer |
+ writer := self xmlWriter on: s.
+ writer xmlDeclaration: '1.0'.
+ writer startTag: 'recording'; endTag.
+ writer tag: 'creator' pcData: creator.
+ writer tag: 'timestamp' pcData: timeStamp.
+ writer tag: 'duration' pcData: duration.
+ writer startTag: 'tracks'; endTag.
+ tracks do:[:tdata|
+ writer startTag: 'track'; attribute: 'type' value: tdata value; endTag.
+ writer pcData: tdata key.
+ writer endTag: 'track'.
+ ].
+ writer endTag: 'tracks'.
+ writer endTag: 'recording'.
+ ].
+ !

Item was added:
+ ----- Method: DebuggerMethodMapTests>>foo: (in category 'fixtures') -----
+ foo: foo
+
+ foo = #foo ifTrue: [^ true].
+ ^ (foo ifNil: [^ false]) = #bar!

Item was added:
+ ----- Method: DebuggerMethodMapTests>>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 := self class >> #asXML.
+ map := DebuggerMethodMap forMethod: method.
+ retpc := method endPC.
+ before := map rangeForPC: retpc in: method contextIsActiveContext: false.
+ map instVarNamed: 'abstractSourceRanges' put: nil.
+ after := map rangeForPC: retpc in: method contextIsActiveContext: false.
+ self assert: before size > 500.
+ self assert: before = after!

Item was added:
+ ----- Method: DebuggerMethodMapTests>>testRangeIsRoundedUp (in category 'tests') -----
+ testRangeIsRoundedUp
+
+ | actualRange map method minRangeStart pc source |
+ method := self class >> #foo:.
+ map := DebuggerMethodMap forMethod: method.
+ pc := method concretePCForAbstractPC: (method symbolic lines findFirst: [:line | line includesSubstring: 'return: true']) + 1.
+ source := method getSource asString.
+
+ minRangeStart := source findString: '^ (foo'.
+ actualRange := map rangeForPC: pc in: method contextIsActiveContext: true.
+
+ self assert: actualRange start >= minRangeStart.!