Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
47 lines
783 B
Nix
47 lines
783 B
Nix
{
|
|
nano,
|
|
expect,
|
|
runCommand,
|
|
writeScriptBin,
|
|
}:
|
|
|
|
let
|
|
expect-script = writeScriptBin "expect-script" ''
|
|
#!${expect}/bin/expect -f
|
|
|
|
# Load nano
|
|
spawn nano file.txt
|
|
expect "GNU nano ${nano.version}"
|
|
|
|
# Add some text to the buffer
|
|
send "Hello world!"
|
|
expect "Hello world!"
|
|
|
|
# Send ctrl-x (exit)
|
|
send "\030"
|
|
expect "Save modified buffer?"
|
|
|
|
# Answer "yes"
|
|
send "y"
|
|
expect "File Name to Write"
|
|
|
|
# Send "return" to accept the file path.
|
|
send "\r"
|
|
sleep 1
|
|
exit
|
|
'';
|
|
in
|
|
runCommand "nano-test-expect"
|
|
{
|
|
nativeBuildInputs = [
|
|
nano
|
|
expect
|
|
];
|
|
passthru = { inherit expect-script; };
|
|
}
|
|
''
|
|
expect -f ${expect-script}/bin/expect-script
|
|
grep "Hello world!" file.txt
|
|
touch $out
|
|
''
|