a83d4cbced
Also make fields in `termios` public; required for modifying them. There's an new type of test: `EXPECT_INPUT_BINS`. These require a `.exp` file to be present along with the `.c` file. The `.exp` file takes the produced binary as an argument and sends input to the program. This is useful for testing functions like `getpass()`.
18 lines
382 B
Plaintext
18 lines
382 B
Plaintext
#!/usr/bin/expect
|
|
|
|
set testgetpass [lindex $argv 0];
|
|
|
|
spawn $testgetpass
|
|
expect "Enter password: "
|
|
send -- "pass\r"
|
|
|
|
expect "Enter password: "
|
|
send -- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r"
|
|
|
|
expect "Enter password: "
|
|
send -- "\r"
|
|
|
|
expect {
|
|
"incorrect password" { exit 123 }
|
|
eof
|
|
} |