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

test[u8Debugger] 003 - Excecuting on debugee side

"Accessing class of the receiver on topFrame"
U8Debugee current callFrames first this
call: 'function(){return this.$$class().name();}'
doing: [:result :thr|
	thr = false ifFalse: [
		self note: 'Has thrown is ' ,thr
	].
	JS @ result handle @ #type = #string ifFalse: [
		self error: 'Must return #string'
	].
	self note: 'The receiver in topFrame was an instance of '
		,(JS @ result handle @ #value)
].
^#Ok


"Evaluate a function with one argument (on topFrame)"
U8Debugee current callFrames first this
	call: 'function(x){return x+3;}'
	arguments: #( 12 ) 
	doing: [:result :thr|
		result type = #number ifFalse: [ self error: 'Must be number' ].
		result value = 15 ifFalse: [ self error: 'Must be 15' ].
		result description = '15' ifFalse: [ self error: 'Must be #15' ].
	]


"Print (sorted) selectors of Point on debugee"
U8Debugee current callFrames first this
call: 'function(){return this.smalltalk().Point.selectors().sorted();}'
doing: [:result :thr| self print: JS @> result handle.
result arrayDo: [:array| 
	self print: array asLiteral
] ]