Freddy Vulto c86b336769 (testuite) Fix tests to run with autotools' make distcheck
File locations are prefixed with `$::srcdir' so that `make distcheck' can
execute the test suite using a relative path.

The current working directory is removed from the test-suite-bash-prompt.

Furthermore, no more dynamic creation of files in dir $::srcdir/fixtures since
this dir is read-only during `make distcheck'.  Instead create dynamic files in
$TESTDIR/tmp

The test suite uses these "directory" variables

   tcl            bash          description
   ------------   -----------   ------------------------------------
   $::srcdir      $SRCDIR       where `fixtures' reside, relative
   $::srcdirabs   $SRCDIRABS    where `fixtures' reside, absolute
   $::TESTDIR     $TESTDIR      where `runtest' is invoked, absolute
2010-11-12 23:35:36 +01:00

96 lines
1.7 KiB
Plaintext

proc setup {} {
save_env
}
proc teardown {} {
assert_env_unmodified
}
setup
assert_complete_any "perl "
sync_after_int
set test "Second argument should file complete"
set cmd "perl foo $::srcdir/fixtures/shared/default/f"
send "$cmd\t"
expect {
-re "^$cmd\r\nfoo +foo.d/ *\r\n/@${cmd}oo$" { pass "$test" }
-re /@ { unresolved "$test at prompt" }
-re eof { unresolved "eof" }
}
sync_after_int
set test "-I without space should complete directories"
set cmd "perl -I$::srcdir/fixtures/shared/default/"
send "$cmd\t"
expect {
-re "^$cmd\r\nbar bar.d/ +foo.d/ *\r\n/@$cmd$" { pass "$test" }
-re /@ { unresolved "$test at prompt" }
-re eof { unresolved "eof" }
}
sync_after_int
set test "-I with space should complete directories"
set cmd "perl -I $::srcdir/fixtures/shared/default/"
send "$cmd\t"
expect {
-re "^$cmd\r\nbar bar.d/ +foo.d/ *\r\n/@$cmd$" { pass "$test" }
-re /@ { unresolved "$test at prompt" }
-re eof { unresolved "eof" }
}
sync_after_int
set test "-x without space should complete directories"
set cmd "perl -x$::srcdir/fixtures/shared/default/b"
send "$cmd\t"
expect {
-re "^${cmd}ar\\\\ bar.d/ *$" { pass "$test" }
-re /@ { unresolved "$test at prompt" }
-re eof { unresolved "eof" }
}
sync_after_int
set test "-x with space should complete directories"
set cmd "perl -x $::srcdir/fixtures/shared/default/b"
send "$cmd\t"
expect {
-re "^${cmd}ar\\\\ bar.d/ *$" { pass "$test" }
-re /@ { unresolved "$test at prompt" }
-re eof { unresolved "eof" }
}
sync_after_int
set test "- should complete options"
set options {
-0 -a -c -C -d -D -e -F -h -i -I -l -m -M -n -p -P -s -S -T -u -U -v -V -w -W -x -X
}
assert_complete $options "perl -"
sync_after_int
teardown