[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

test[u8Debugger] 002 - Test callFrames

"Check call stack"
U8Debugee current callFrames size > 10 ifFalse: [
	self error: 'Small call stack found.'
].


"Check Object on top of call stack"
(U8Debugee current topFrame this toString includes: '$s8Constructor') ifFalse: [
	self error: 'The receiver on top must be a S8 Object.'
].


"Check #halt on top frame"
| top binding |
top := U8Debugee current topFrame.
binding := top source binding.
binding selector = #halt ifFalse: [ ^self error: 'Invalid message on topFrame. Must be #halt' ].
binding implementor = #Object ifFalse: [ ^self error: 'Must be Object' ].


"Check fourth frame"
| scopes object |
scopes := U8Debugee current callFrames fourth scopes.
scopes size = 3 ifFalse: [ ^self error: 'Must be 3 scopes in fourth callFrame' ].
scopes first type = #local ifFalse: [ ^self error: 'Must be local scope' ].
scopes second type = #closure ifFalse: [ ^self error: 'Must be closure' ].
scopes last type = #global ifFalse: [ ^self error: 'Must be global' ].
object := scopes first object.
object type = #object ifFalse: [ ^self error: '#object expected'].
object description = #Object ifFalse: [ ^self error: 'Object expected'].