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

test[scripting] 535 - Compiler superSend

"preparing methods using super"
! Object methodsFor: #testing !
mustBeDNU
	^super yourself! !

! Object methodsFor: #testing !
mustBeOk
	^#ok! !

! ScriptCompilerTest methodsFor: #testing !
ok
	^super mustBeOk! !

! ScriptCompilerTest class methodsFor: #testing !
ok
	^super mustBeOk! !

! ScriptCompilerTest methodsFor: #testing !
mustBeOk
	^#wrong! !



"testing methods with super - mustBeDNU "
(ScriptParser new parse: '[ (3@4) mustBeDNU ] on: Error do: [:ex| #ok ]') evaluate = #ok
    ifFalse: [ self error: 'Must be DNU' ].

"testing methods with super - mustBeOk "
(ScriptParser new parse: 'nil mustBeOk') evaluate = #ok
    ifFalse: [ self error: 'Must be #ok (nil)' ].
(ScriptParser new parse: '12 mustBeOk') evaluate = #ok
    ifFalse: [ self error: 'Must be #ok (12)' ].
(ScriptParser new parse: 'ScriptCompilerTest new mustBeOk') evaluate = #wrong
    ifFalse: [ self error: 'Must be #wrong' ].
(ScriptParser new parse: 'ScriptCompilerTest new ok') evaluate = #ok
    ifFalse: [ self error: 'Must be #ok (aScriptCompilerTest)' ].
(ScriptParser new parse: 'ScriptCompilerTest ok') evaluate = #ok
    ifFalse: [ self error: 'Must be #ok (ScriptCompilerTest)' ].

"testing super evaluation"
(((ScriptParser for: ScriptCompilerTest) parse: 'super ok') evaluate: ScriptCompilerTest new) = #ok
    ifFalse: [ self error: 'Must be #ok (super)' ].


"removing test methods"
Object removeSelector: #mustBeDNU.
Object removeSelector: #mustBeOk.
ScriptCompilerTest removeSelector: #ok.
ScriptCompilerTest removeSelector: #mustBeOk.
ScriptCompilerTest class removeSelector: #ok.