test output options
This commit is contained in:
parent
d146127911
commit
4f6c21ec77
7 changed files with 84 additions and 72 deletions
|
@ -1,10 +0,0 @@
|
|||
{it, ...}: let
|
||||
pkgs = import <nixpkgs> {}; # impure ¯\_(ツ)_/¯
|
||||
run = import ../tix/run.nix pkgs;
|
||||
output = run [./it.test.nix];
|
||||
in [
|
||||
(it "makes a derivation called test" {
|
||||
expected = "test";
|
||||
actual = output.name;
|
||||
})
|
||||
]
|
|
@ -1,52 +1,55 @@
|
|||
{describe, it, ... }:
|
||||
let
|
||||
{
|
||||
describe,
|
||||
it,
|
||||
...
|
||||
}: let
|
||||
mockpkgs = {
|
||||
writeShellScriptBin = name: content: content;
|
||||
inotify-tools = "inotify-tools";
|
||||
};
|
||||
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
|
||||
'';
|
||||
}))
|
||||
]
|
||||
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
|
||||
'';
|
||||
})
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue