[View] [Edit] [Lock] [References] [Attachments] [History] [Home] [Changes] [Search] [Help]
test[scripting] 022 - Special names
"Using #self"
((ScriptParser new parse: 'self = 7') evaluate: 3+4)
ifFalse: [ self error: 'Error evaluating expression with #self' ]
"Using #nil"
(ScriptParser new parse: 'nil isNil') evaluate = true
ifFalse: [ self error: 'Error evaluating expression with #nil' ].
(ScriptParser new parse: 'nil = nil') evaluate = true
ifFalse: [ self error: 'Error evaluating expression with #nil' ].
(ScriptParser new parse: 'nil == nil') evaluate = true
ifFalse: [ self error: 'Error evaluating expression with #nil' ].
"Using #true and #false"
(ScriptParser new parse: 'true not = false') evaluate = true
ifFalse: [ self error: 'Error evaluating expression with #true and #false' ]
"Using instance variables"
(((ScriptParser for: Point) parse: 'x = 3') evaluate: 3@4)
ifFalse: [ self error: 'Error evaluating expression with iv #x' ].
(((ScriptParser for: Point) parse: 'x + 1 = y') evaluate: 3@4)
ifFalse: [ self error: 'Error evaluating expression with iv #x' ].