[View] [Edit] [Lock] [References] [Attachments] [History] [Home] [Changes] [Search] [Help]
test[scripting] 030 - Iterations and arrays
"Times repeat"
(ScriptParser new parse: '3 timesRepeat: [:i| self print: #hello ,i ]') evaluate
"Block arguments"
(ScriptParser new parse: '[:i| self print: #hello ,i ] argumentCount') evaluate = 1 ifFalse: [
self error: 'Must be 1'
]
"do loop"
(ScriptParser new parse: '#( 1 2 3 ) do: [:i| self print: #hello ,i ]') evaluate
"perform do"
(ScriptParser new parse: '#( 1 2 3 ) perform: #do: with: [:i| self print: #hello ,i ]') evaluate
"block evaluation"
(ScriptParser new parse: '[:i| self print: #hello ,i.12 ] value: #world') evaluate = 12 ifFalse: [
self error: 'Must be 12'
]