biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / applications / editors / micro / test-with-expect.nix
blobd3e1d60e08748939ee4351a1071f4464e69efb69
1 { micro, expect, runCommand, writeScript, runtimeShell }:
3 let expect-script = writeScript "expect-script" ''
4   #!${expect}/bin/expect -f
6   spawn micro file.txt
7   expect "file.txt"
9   send "Hello world!"
10   expect "Hello world!"
12   # Send ctrl-q (exit)
13   send "\021"
15   expect "Save changes to file.txt before closing?"
16   send "y"
18   expect eof
19 ''; in
20 runCommand "micro-test-expect"
22   nativeBuildInputs = [ micro expect ];
23   passthru = { inherit expect-script; };
24 } ''
25   # Micro really wants a writable $HOME for its config directory.
26   export HOME=$(pwd)
27   expect -f ${expect-script}
28   grep "Hello world!" file.txt
29   touch $out