list to attrs, restructure output
This commit is contained in:
parent
cc834eda99
commit
5007770e88
10 changed files with 66 additions and 58 deletions
|
|
@ -1,13 +1,6 @@
|
|||
name: tests:
|
||||
builtins.trace "tix: ├── ${name}"
|
||||
{
|
||||
component = name;
|
||||
results = map ({
|
||||
msg,
|
||||
success,
|
||||
actual ? null,
|
||||
expected ? null,
|
||||
} @ result:
|
||||
result)
|
||||
tests;
|
||||
inherit name;
|
||||
value = builtins.listToAttrs tests;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,5 +10,7 @@ in rec {
|
|||
}] | add
|
||||
}] | add
|
||||
'';
|
||||
overview = failures;
|
||||
overview = ''
|
||||
.
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
41
tix/it.nix
41
tix/it.nix
|
|
@ -1,4 +1,4 @@
|
|||
msg: {
|
||||
name: {
|
||||
actual,
|
||||
expected ? {},
|
||||
asString ? false,
|
||||
|
|
@ -6,6 +6,7 @@ msg: {
|
|||
removeDunders ? false,
|
||||
safeToPrint ? true,
|
||||
throws ? false,
|
||||
debug ? false,
|
||||
}: let
|
||||
emotes = import ./emotes.nix;
|
||||
|
||||
|
|
@ -27,20 +28,26 @@ msg: {
|
|||
else v;
|
||||
|
||||
success =
|
||||
builtins.trace "tix: │ ├── ${msg}"
|
||||
(
|
||||
if throws
|
||||
then (builtins.tryEval actual).success == false
|
||||
else (a == e)
|
||||
);
|
||||
in
|
||||
{
|
||||
inherit success msg;
|
||||
}
|
||||
// (
|
||||
if success
|
||||
then builtins.trace "tix: │ │ ${emotes.pass}" {}
|
||||
if debug
|
||||
then break
|
||||
else
|
||||
builtins.trace "tix: │ │ ${emotes.fail}"
|
||||
{inherit actual expected;}
|
||||
)
|
||||
builtins.trace "tix: │ ├── ${name}"
|
||||
(
|
||||
if throws
|
||||
then (builtins.tryEval actual).success == false
|
||||
else (a == e)
|
||||
);
|
||||
in {
|
||||
inherit name;
|
||||
value =
|
||||
{
|
||||
inherit success;
|
||||
}
|
||||
// (
|
||||
if success
|
||||
then builtins.trace "tix: │ │ ${emotes.pass}" {}
|
||||
else
|
||||
builtins.trace "tix: │ │ ${emotes.fail}"
|
||||
{inherit actual expected;}
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
pkgs: files: let
|
||||
test = import ./test.nix;
|
||||
res = map test files;
|
||||
res = builtins.listToAttrs (map test files);
|
||||
resFile = builtins.toFile "results" (builtins.toJSON res);
|
||||
filters = import ./filters.nix;
|
||||
getNix = "import ${./eval.nix} ${resFile}";
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ in
|
|||
if !builtins.isFunction suite
|
||||
then throw "A test suite should be in the form { it }: [ <tests> ]."
|
||||
else {
|
||||
inherit path;
|
||||
results = suite {inherit it describe;};
|
||||
name = toString path;
|
||||
value = builtins.listToAttrs (suite {inherit it describe;});
|
||||
}
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue