[View] [Edit] [Lock] [References] [Attachments] [History] [Home] [Changes] [Search] [Help]
test[scripting] 024 - Messages to super
"Test simple messages to super"
3@4 = ((ScriptParser new parse: ' ^super changed ') evaluate: 3@4) ifFalse: [ self error: 'Wrong result' ].
3@4 = (((ScriptParser for: Point) parse: ' super yourself ') evaluate: 3@4) ifFalse: [ self error: 'Wrong result' ].
"preparing to test super reference"
! Object methodsFor: #testing !
myCookie
" Returns the cookie value for testing. "
^#ok! !
! UndefinedObject methodsFor: #testing !
myCookie
" Returns the cookie value for testing. "
^super myCookie ,'nil'! !
! Object methodsFor: #test !
missing
^super missing! !
! Point methodsFor: #test !
missing
^super missing! !
! Point methodsFor: #test !
missing2
^super missing! !
! Point methodsFor: #test !
missing3
^super missing2! !
"using #super (in UndefinedObject context)"
| ok |
ok := (ScriptParser new parse: 'self myCookie') evaluate: 12.
ok = #ok ifFalse: [ self error: 'Must be #ok not ',ok ].
ok := (ScriptParser new parse: 'self myCookie') evaluate.
ok = #oknil ifFalse: [ self error: 'Must be #oknil not ',ok ].
ok := (ScriptParser new parse: 'super myCookie') evaluate.
ok = #ok ifFalse: [ self error: 'Must be #ok. Not ',ok ].
"cleaning super test"
Object removeSelector: #myCookie.
UndefinedObject removeSelector: #myCookie.
Object removeSelector: #missing.
Point removeSelector: #missing.
Point removeSelector: #missing2.
Point removeSelector: #missing3.