# 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 "chaffee@home.com\r"
	expect {
	    "ftp> " {}
	    eof {error "unexpected eof"}
	    timeout {error "unexpected timeout"}
	}
    } msg] {} else {set msg 1}
    catch {close}
    catch {wait}
    set msg
} {1}

