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

test[scripting] 110 - Receiver and Instance variables

"Accessing the receiver"
((ScriptParser new parse: '
    self x * self y') evaluate: 5@4) = 20 ifFalse: [
    self error: 'Must be 20'
]


"Evaluating with aPoint"
((ScriptParser new parse: '
    self x: 10;y: 27;yourself.
    self x * self y') evaluate: 5@7) = 270 ifFalse: [
    self error: 'Must be 270'
]


"Changing aPoint"
(((ScriptParser for: Point)
        parse: ' x := 3. self '
  ) evaluate: 5@7) = (3@7) ifFalse: [
    self error: 'Must be 3@7'
]


"Accessing i.v."
(((ScriptParser for: Point)
        parse: 'x * y'
) evaluate: 10@50) = 500 ifFalse: [
  self error: 'Must be 500'
]