2016-06-27 04:47:36 +00:00
|
|
|
# vim: set filetype=expect:
|
|
|
|
|
2016-06-30 02:46:11 +00:00
|
|
|
set ::env(fish_escape_delay_ms) 10
|
2016-06-27 04:47:36 +00:00
|
|
|
spawn $fish_key_reader -c
|
|
|
|
|
|
|
|
# Do we get the expected startup prompt?
|
|
|
|
expect -ex "Press a key" {
|
|
|
|
puts "saw expected startup prompt"
|
|
|
|
} unmatched {
|
|
|
|
puts stderr "didn't see expected startup prompt"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Is a single control char echoed correctly?
|
|
|
|
send "\x01"
|
2016-06-30 02:46:11 +00:00
|
|
|
expect -ex "char: \\cA\r\nbind \\cA 'do something'\r\n" {
|
2016-06-27 04:47:36 +00:00
|
|
|
puts "ctrl-a handled"
|
|
|
|
} unmatched {
|
|
|
|
puts stderr "ctrl-a not handled"
|
|
|
|
}
|
|
|
|
|
2016-06-30 02:46:11 +00:00
|
|
|
# Is a non-ASCII UTF-8 sequence prefaced by an escape char handled correctly?
|
|
|
|
sleep 0.020
|
|
|
|
# send "\x1B\xE1\x88\xB4"
|
|
|
|
send "\x1B\u1234"
|
|
|
|
expect -ex "char: \\u1234\r\nbind \\e\\u1234 'do something'\r\n" {
|
|
|
|
puts "unicode char, handled"
|
|
|
|
} unmatched {
|
|
|
|
puts stderr "unicode char, not handled"
|
2016-06-27 04:47:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Is a NULL char echoed correctly?
|
2016-06-30 02:46:11 +00:00
|
|
|
sleep 0.020
|
2016-06-27 04:47:36 +00:00
|
|
|
send -null
|
2016-06-30 02:46:11 +00:00
|
|
|
expect -ex "char: \\c@\r\nbind \\c@ 'do something'\r\n" {
|
2016-06-27 04:47:36 +00:00
|
|
|
puts "\\c@ handled"
|
|
|
|
} unmatched {
|
|
|
|
puts stderr "\\c@ not handled"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Does it keep running if handed control sequences in the wrong order?
|
|
|
|
send "\x03\x04"
|
|
|
|
expect -ex "char: \\cD\r\n" {
|
|
|
|
puts "invalid terminate sequence handled"
|
|
|
|
} unmatched {
|
|
|
|
puts stderr "invalid terminate sequence not handled"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Now send a second [ctrl-D]. Does that terminate the process like it should?
|
|
|
|
send "\x04"
|
|
|
|
expect -ex "char: \\cD\r\n" {
|
|
|
|
puts "valid terminate sequence handled"
|
|
|
|
} unmatched {
|
|
|
|
puts stderr "valid terminate sequence not handled"
|
|
|
|
}
|
|
|
|
expect -ex "Exiting at your request.\r\n" {
|
|
|
|
puts "exited on seeing valid terminate"
|
|
|
|
} unmatched {
|
|
|
|
puts stderr "did not exit on seeing valid terminate sequence"
|
2016-06-30 02:46:11 +00:00
|
|
|
}
|