2021-09-18 13:31:03 +03:00
|
|
|
#!/usr/bin/env expect
|
2022-03-11 14:41:49 +03:00
|
|
|
# TODO: move this script somewere else
|
2021-09-19 02:18:22 +03:00
|
|
|
# TODO: run without NO_DECODE_PROGRESS
|
2021-09-18 13:31:03 +03:00
|
|
|
|
|
|
|
log_user 1
|
2022-03-11 14:41:49 +03:00
|
|
|
set timeout 3
|
2021-09-18 13:31:03 +03:00
|
|
|
|
|
|
|
expect_after {
|
|
|
|
timeout {exit 1}
|
|
|
|
}
|
|
|
|
|
2022-03-15 20:10:33 +03:00
|
|
|
proc expect_prompt {} {
|
|
|
|
global spawn_id
|
|
|
|
sleep 0.2
|
|
|
|
expect *
|
|
|
|
send "\n"
|
|
|
|
expect "> "
|
|
|
|
}
|
|
|
|
|
2021-09-19 02:18:22 +03:00
|
|
|
spawn sh -c "NO_DECODE_PROGRESS=1 fq -o color=false -i . pkg/interp/testdata/test.mp3 2>&1"
|
2021-09-18 13:31:03 +03:00
|
|
|
|
2022-03-15 20:10:33 +03:00
|
|
|
expect_prompt
|
2021-09-18 13:31:03 +03:00
|
|
|
|
|
|
|
send ".\n"
|
|
|
|
expect "footers"
|
2022-03-15 20:10:33 +03:00
|
|
|
expect_prompt
|
2021-09-18 13:31:03 +03:00
|
|
|
|
2022-03-11 14:41:49 +03:00
|
|
|
# test interrupt multiple outputs
|
|
|
|
send "range(100000) | d\n"
|
|
|
|
expect "123"
|
|
|
|
# ctrl-c
|
|
|
|
send "\x03"
|
2022-03-15 20:10:33 +03:00
|
|
|
expect_prompt
|
2022-03-11 14:41:49 +03:00
|
|
|
|
2022-03-11 18:22:23 +03:00
|
|
|
# test interrupt multiple outputs implicit display
|
|
|
|
send "range(100000)\n"
|
|
|
|
expect "123"
|
|
|
|
# ctrl-c
|
|
|
|
send "\x03"
|
2022-03-15 20:10:33 +03:00
|
|
|
expect_prompt
|
2022-03-11 18:22:23 +03:00
|
|
|
|
2022-03-11 14:41:49 +03:00
|
|
|
# test interrupt big json output
|
|
|
|
send "\[range(100000)\] | d\n"
|
|
|
|
expect "123"
|
|
|
|
# ctrl-c
|
|
|
|
send "\x03"
|
2022-03-15 20:10:33 +03:00
|
|
|
expect_prompt
|
2022-03-11 14:41:49 +03:00
|
|
|
|
2022-03-11 18:22:23 +03:00
|
|
|
# test interrupt big json output implicit display
|
|
|
|
send "\[range(100000)\]\n"
|
|
|
|
expect "123"
|
|
|
|
# ctrl-c
|
|
|
|
send "\x03"
|
2022-03-15 20:10:33 +03:00
|
|
|
expect_prompt
|
2022-03-11 18:22:23 +03:00
|
|
|
|
2022-03-11 14:41:49 +03:00
|
|
|
# test exit
|
2021-09-18 13:31:03 +03:00
|
|
|
# ctrl-d
|
|
|
|
send "\x04"
|
|
|
|
expect eof
|