Expect

Artifact Content
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Artifact 7f55912f7bb4fc436b9a02b9bedeb0667f13fdb0:


# Commands covered:  spawn, expect interacting with ftp
#
# This file contains a collection of tests for one or more of the Expect
# command capabilities.  Sourcing this file into Tcl runs the tests and
# generates output for errors.  No output means no errors were found.
#
# Copyright (c) 1997 Mitel, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: $Header: /disk/3/CVSROOT/Mitel/expect/win/tests/ftp.test,v 1.1 1997/09/05 05:30:39 chaffee Exp $

if {[string compare test [info procs test]] == 1} then {source defs}

catch {unset a}
catch {unset x}

# Basic ftp tests.

test ftp-1.1 {basic ftp tests} {
    if [catch {
	set timeout 100
	spawn ftp
	expect {
	    "ftp> " {}
	    eof {error "unable to spawn ftp"}
	    timeout {error "no response seen from ftp"}
	}
	send "open tsx-11.mit.edu\r"
	expect {
	    "(none)): " {}
	    eof {error "unexpected eof"}
	    timeout {error "timeout connecting to tsx-11.mit.edu"}
	}
	send "ftp\r"
	expect {
	    "Password:" {}
	    eof {error "unexpected eof"}
	    timeout {error "unexpected timeout"}
	}
	send "[email protected]\r"
	expect {
	    "ftp> " {}
	    eof {error "unexpected eof"}
	    timeout {error "unexpected timeout"}
	}
    } msg] {} else {set msg 1}
    catch {close}
    catch {wait}
    set msg
} {1}