rework watch command
This commit is contained in:
parent
4f6c21ec77
commit
3faf0e6354
6 changed files with 32 additions and 61 deletions
|
@ -10,46 +10,10 @@
|
|||
watch = import ../tix/watch.nix mockpkgs;
|
||||
in
|
||||
describe "watch" [
|
||||
(it "watches a the local directory and runs command on change" {
|
||||
actual = watch {
|
||||
cmd = "run me";
|
||||
};
|
||||
expected = ''
|
||||
while true
|
||||
do
|
||||
run me &
|
||||
inotify-tools/bin/inotifywait -e modify -r .
|
||||
${""}
|
||||
done
|
||||
'';
|
||||
})
|
||||
(it "runs the command provided to stop execution" {
|
||||
actual = watch {
|
||||
cmd = "run me";
|
||||
stop = "kill me";
|
||||
};
|
||||
expected = ''
|
||||
while true
|
||||
do
|
||||
run me &
|
||||
inotify-tools/bin/inotifywait -e modify -r .
|
||||
kill me
|
||||
done
|
||||
'';
|
||||
})
|
||||
(it "pipes output to given command" {
|
||||
actual = watch {
|
||||
cmd = "run me";
|
||||
stop = "kill me";
|
||||
view = "less";
|
||||
};
|
||||
expected = ''
|
||||
while true
|
||||
do
|
||||
run me | less &
|
||||
inotify-tools/bin/inotifywait -e modify -r .
|
||||
kill me
|
||||
done
|
||||
'';
|
||||
(it "contains the command" {
|
||||
actual = builtins.match ".*(run me).*" ( watch {
|
||||
cmd = "run me";
|
||||
} );
|
||||
expected = ["run me"];
|
||||
})
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue