add tests
This commit is contained in:
parent
aeb174ac65
commit
0b7f5ad721
12 changed files with 73 additions and 16 deletions
1
test/bad/string.nix
Normal file
1
test/bad/string.nix
Normal file
|
@ -0,0 +1 @@
|
|||
"This isn't a test suite!"
|
11
test/it.test.nix
Normal file
11
test/it.test.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ it, ... }:
|
||||
[
|
||||
(it "test's itself???" rec {
|
||||
expected = {success = true; msg = "test's itself???";};
|
||||
actual =
|
||||
(it "test's itself???" {
|
||||
expected = expected;
|
||||
actual = expected;
|
||||
});
|
||||
})
|
||||
]
|
12
test/run.test.nix
Normal file
12
test/run.test.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{ 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;
|
||||
})
|
||||
]
|
18
test/test.test.nix
Normal file
18
test/test.test.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{ it, ... }:
|
||||
let
|
||||
test = import ../tix/test.nix;
|
||||
in
|
||||
[
|
||||
(it "get's test results" {
|
||||
expected = [{"msg" = "test's itself???"; "success"= true;}];
|
||||
actual = ( test ./it.test.nix ).results;
|
||||
})
|
||||
(it "has a path" {
|
||||
actual = builtins.typeOf ( test ./it.test.nix ).path;
|
||||
expected = "path";
|
||||
})
|
||||
(it "fails to build non test" {
|
||||
actual = ( test ./bad/string.nix );
|
||||
throws = true;
|
||||
})
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue