File size: 1,146 Bytes
fc0f7bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# 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}
    }
}