Skip to content

Instantly share code, notes, and snippets.

@dtzWill
Created December 19, 2017 20:53
Show Gist options
  • Save dtzWill/23987bf3b4160dc41711670a33adc603 to your computer and use it in GitHub Desktop.
Save dtzWill/23987bf3b4160dc41711670a33adc603 to your computer and use it in GitHub Desktop.
set timeout 2
# Log full session to file, not to stdout ("user")
log_file -a repl.log
log_user 0
set prompt "repl> "
proc test_completion { input completion {tab "\t" } } {
global prompt
send_user "\r\nTesting tab-completion from '$input' to '$completion' ... "
send -- "$input$tab"
expect {
"$completion" { send_user "PASS\r\n" }
timeout {
send_user "FAIL\r\n"
exit 1
}
}
# Clear, new prompt
send -- "\r"
expect $prompt
}
spawn nix repl
expect $prompt
# Quick sanity check -- test ":?" command
send -- ":?\r"
expect "The following commands are available:"
expect $prompt
test_completion "__addError" "__addErrorContext"
test_completion "" "toString" "\t\t"
send -- ":q\r"
expect eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment