rework describe function
This commit is contained in:
parent
f125ec4c31
commit
2df95bbc56
7 changed files with 77 additions and 52 deletions
|
|
@ -1,9 +1,13 @@
|
|||
name:
|
||||
name: tests:
|
||||
builtins.trace "tix: ├── ${name}"
|
||||
map ({
|
||||
msg,
|
||||
success,
|
||||
actual ? null,
|
||||
expected ? null,
|
||||
} @ result:
|
||||
result // {msg = "${name}: ${msg}";})
|
||||
{
|
||||
component = name;
|
||||
results = map ({
|
||||
msg,
|
||||
success,
|
||||
actual ? null,
|
||||
expected ? null,
|
||||
} @ result:
|
||||
result)
|
||||
tests;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,15 @@ let
|
|||
in {
|
||||
overview = ''
|
||||
.[] | {
|
||||
(.path): {
|
||||
"${emotes.fail}": [.results | map(select(.success==false))[] | {(.msg): {actual, expected}}],
|
||||
"${emotes.pass}": .results | map(select(.success) | .msg) | length
|
||||
}
|
||||
(.path):
|
||||
.results[] | {
|
||||
(.component): {
|
||||
"${emotes.fail}": [
|
||||
.results | map(select(.success==false))[] | {(.msg): {actual, expected}}
|
||||
],
|
||||
"${emotes.pass}": .results | map(select(.success) | .msg) | length
|
||||
}
|
||||
}
|
||||
}
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
12
tix/it.nix
12
tix/it.nix
|
|
@ -26,13 +26,13 @@ msg: {
|
|||
then builtins.removeAttrs v ["__toString" "__functor"]
|
||||
else v;
|
||||
|
||||
success =
|
||||
success =
|
||||
builtins.trace "tix: │ ├── ${msg}"
|
||||
(
|
||||
if throws
|
||||
then (builtins.tryEval actual).success == false
|
||||
else (a == e)
|
||||
);
|
||||
(
|
||||
if throws
|
||||
then (builtins.tryEval actual).success == false
|
||||
else (a == e)
|
||||
);
|
||||
in
|
||||
{
|
||||
inherit success msg;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue