Blob Blame History Raw

# expect/tcl code to test the das scanner
# jhrg
#
# $Log: scanner.2.exp,v $
# Revision 1.3  2002/06/03 22:21:16  jimg
# Merged with release-3-2-9
#
# Revision 1.2.54.1  2001/11/01 00:43:52  jimg
# Fixes to the scanners and parsers so that dataset variable names may
# start with digits. I've expanded the set of characters that may appear
# in a variable name and made it so that all except `#' may appear at
# the start. Some characters are not allowed in variables that appear in
# a DDS or CE while they are allowed in the DAS. This makes it possible
# to define containers with names like `COARDS:long_name.' Putting a colon
# in a variable name makes the CE parser much more complex. Since the set
# of characters that people want seems pretty limited (compared to the
# complete ASCII set) I think this is an OK approach. If we have to open
# up the expr.lex scanner completely, then we can but not without adding
# lots of action clauses to teh parser. Note that colon is just an example,
# there's a host of characters that are used in CEs that are not allowed
# in IDs.
#
# Revision 1.2  1997/05/05 20:29:22  jimg
# *** empty log message ***
#
# Revision 1.1  1996/07/16 16:54:33  jimg
# Added.
#
#

global comp_output		# contains output from das-test_start
global verbose			# this and srcdir are set by runtest.exp
global srcdir

set test_name scanner.2

set prompt "das-test:"
set timeout 2
set pass 1

das-test_start s

expect {
    "${prompt} " { 
    }
    timeout { 
	send_user "Timeout\n"
	set pass 0
    }
}

if {$pass} {
    set thing "a\r\n"
    send $thing

    expect {
	-re ".*WORD=${thing}${prompt} $" { 
	}
	timeout { 
	    send_user "Timeout\n"
	    set pass 0
	}
    }
}

if {$pass} {
    set thing "averylongidentifierthatishardtoread\r\n"
    send $thing

    expect {
	-re ".*WORD=${thing}${prompt} $" { 
	}
	timeout { 
	    send_user "Timeout\n"
	    set pass 0
	}
    }
}

if {$pass} {
    set thing "a_very_long_identifier_that_is_not_hard_to_read\r\n"
    send $thing

    expect {
	-re ".*WORD=${thing}${prompt} $" { 
	}
	timeout { 
	    send_user "Timeout\n"
	    set pass 0
	}
    }
}

if {$pass} {
    set thing "One_That_HASCAPITALS\r\n"
    send $thing

    expect {
	-re ".*WORD=${thing}${prompt} $" { 
	}
	timeout { 
	    send_user "Timeout\n"
	    set pass 0
	}
    }
}

if {$pass} {
    set thing "One_That_has_1234567890\r\n"
    send $thing

    expect {
	-re ".*WORD=${thing}${prompt} $" { 
	}
	timeout { 
	    send_user "Timeout\n"
	    set pass 0
	}
    }
}

if {$pass} {
    set thing "z1234567890\r\n"
    send $thing

    expect {
	-re ".*WORD=${thing}${prompt} $" { 
	}
	timeout { 
	    send_user "Timeout\n"
	    set pass 0
	}
    }
}

# Some things that are *not* identifiers! These should scan as strings.
# But now (5/5/97) people have convinced me to let these through! Arrgh...
# jhrg.

if {$pass} {
    set thing "a0.9\r\n"
    send $thing

    expect {
	-re ".*WORD=${thing}${prompt} $" { 
	}
	timeout { 
	    send_user "Timeout\n"
	    set pass 0
	}
    }
}

if {$pass} {
    pass $test_name
} else {
    fail $test_name
}

das-test_exit