#!/usr/bin/env expect-lite
# 
# Test expect-lite directives (requires version 3.5.0 or later)
#
*NODEBUG
# Turn on warnings
*WARN
@3
; === Check hello at beginning of test
>echo hello
+$answer=\n(hello)
# self check
?if $answer != hello ? >echo FAIL :: >echo Good
<\nGood

# set tcsh for test, but not at beginning of file
**SHELL=tcsh

# set End of Line Sequence (eols)
*EOLS CRLF
>
*EOLS LF
*NOFAIL
>
*~self_test_fail_script.txt
>echo "hello"
<fail this

*NOINFO
#; === Quiet check with NOINFO
$temp=fine
>
# self check
?if $temp != fine ? >echo FAIL :: >echo Good
<\nGood
>

>
*NOWARN
; === See no warning
@1
> sleep 2
>
>
*WARN
>
; === See prompt timeout warning
@1
> sleep 2
>
>
>
>
; === Check timeout error
@two
>
*INFO
; === check logging
*LOG /tmp/$arg0.log
>echo hello
>
*NOLOG
; === check log
>grep hello /tmp/$arg0.log
<\nhello
>
*LOG /tmp/$arg0.log
>echo goodbye
>
*NOLOG
>
; === check log append
>egrep 'hello|goodbye' /tmp/$arg0.log
<\nhello
<\ngoodbye
>rm /tmp/$arg0.log
>
; === check log with no permissions
*LOG /root/$arg0.log
>echo hello
>


>
#Pau!

