FEA-Bench / testbed /facebookresearch__hydra /tests /scripts /test_bash_completion.exp
hc99's picture
Add files using upload-large-folder tool
fc0f7bd verified
raw
history blame
1.15 kB
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
log_user 0
set timeout 4
set env(PS1) >>
# Under pycharm, for some unknown reason readline displays
# the suggestions in a different order, breaking the test.
# This enables debug output from Hydra which is easier to test
set env(HYDRA_COMP_DEBUG) 1
set env(INPUTRC) /dev/null
# Suppress bash deprecation warning on Mac
set env(BASH_SILENCE_DEPRECATION_WARNING) 1
# parray env
spawn bash --norc --noprofile
expect >>
set in_line [lindex $argv 1]
set len [expr [string length $in_line] - 1]
set line [string range $in_line 5 $len]
set num_tabs [lindex $argv 2]
puts "input line: '$line'"
puts "num_tabs: $num_tabs"
send "eval \"\$([lindex $argv 0] -sc install=bash)\"\r"
expect >>
set command "[lindex $argv 0] $line"
while {$num_tabs > 0} {
incr num_tabs -1
append command "\t"
}
puts "command: '$command'"
send $command
puts "\nMatching:\n"
foreach arg [lrange $argv 3 end] {
expect {
"$arg" {puts "matched '$arg' to '$expect_out(0,string)'\nbuffer: '$expect_out(buffer)'";continue}
timeout {puts "Error matching $arg"; exit 1}
}
}