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

test[scripting] 120 - Global names

"Creating global variable (Test)"
Smalltalk at: #Test put: 3 * 4.
(ScriptParser new parse: '
    Test := 10. Test
') evaluate = 10 ifFalse: [
  self error: 'Must be 10'
]


"Using global variable (Test)"
(ScriptParser new parse: '
    Test * 10
') evaluate = 100 ifFalse: [
  self error: 'Must be 100'
]


"Removing global variable (Test)"
(ScriptParser new parse: '
    Smalltalk removeKey: #Test ifAbsent: []
') evaluate = Smalltalk current ifFalse: [
  self error: 'Wrong result'
]