mirror of
https://github.com/gnustep/libs-steptalk.git
synced 2025-02-16 00:11:29 +00:00
added distant scripting test
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/steptalk/trunk@21705 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3cecc2c163
commit
11a76485a1
1 changed files with 46 additions and 0 deletions
46
Testing/Smalltalk/distant.st
Normal file
46
Testing/Smalltalk/distant.st
Normal file
|
@ -0,0 +1,46 @@
|
|||
" Distant environment example
|
||||
|
||||
Date: 2005 Aug 17
|
||||
Author: Stefan Urbanek
|
||||
|
||||
Usage:
|
||||
1. run: stenvironment -name test
|
||||
2. run: stexec distant.st
|
||||
3. repeat step 2. as many times as you like
|
||||
|
||||
Step 1. creates a scripting environment. Step 2. executes this script.
|
||||
|
||||
"
|
||||
|
||||
"Create a conversation with distant environment"
|
||||
conversation := (STDistantConversation alloc) initWithEnvironmentName:'test'
|
||||
host:nil
|
||||
language:nil.
|
||||
|
||||
Transcript showLine: '-- Conversation created:', (conversation description).
|
||||
|
||||
"Interpret some scripts in the distant environment"
|
||||
conversation interpretScript:'Transcript showLine:\'Hello StepTalk!\'.'.
|
||||
conversation interpretScript:'Environment class description'.
|
||||
|
||||
"Get run count"
|
||||
|
||||
conversation interpretScript:'runCount'.
|
||||
result := conversation resultByCopy.
|
||||
|
||||
"If there is no run count, then we are running first time and we have to
|
||||
define and set the run count to 1"
|
||||
|
||||
result ifNil:
|
||||
[
|
||||
Transcript showLine: ('This script was run for first time.').
|
||||
conversation interpretScript:'runCount := 0'.
|
||||
result := 1.
|
||||
].
|
||||
|
||||
conversation interpretScript:'runCount := runCount + 1'.
|
||||
result := conversation resultByCopy.
|
||||
|
||||
Transcript showLine: ('This script was run ', (result description), ' times.').
|
||||
|
||||
conversation close.
|
Loading…
Reference in a new issue