[Pharo-project] Seach for Tcl Expect equivalent
David T. Lewis
lewis at mail.msen.com
Thu Sep 17 19:31:53 EDT 2009
On Thu, Sep 17, 2009 at 05:32:36AM -0700, Vicnet wrote:
> Expect is a librarie/tools in perl or Tcl that is aim to control a process.
> You could send command on the stdin and wait for answer on stdout, then
> react on this event (thant why it is call 'expect').
> Uselfull for executable tests, or control an automatic telnet session ...
> I know OSProcess to launch executable and play with stdin/stdout but it's
> not exactly what do Expect.
> Do you know something like that on Pharo ?
I do not know of anything equivalent to Expect, but if you are using
OSProcess and CommandShell, then the scripting methods in CommandShell
such as #script:onFailureDo: and #if:then:else: may be of some interest.
There are examples in CommandShellTestCase in category "testing-scripts".
Basically it works like this:
result := CommandShell new
ls -l NOSUCHFILE
onFailureDo: [:p | 'the pipeline collection that failed was ', p printString].
then: ['the script succeeded']
else: ['the script failed']
More information about the Pharo-dev