use describe in docs
This commit is contained in:
parent
32a3950d16
commit
44e647cac0
|
@ -8,8 +8,8 @@ Test your Nix is only ticks.
|
||||||
Make a test file:
|
Make a test file:
|
||||||
|
|
||||||
```mytest.nix
|
```mytest.nix
|
||||||
{ it, ... }:
|
{ describe, it, ... }:
|
||||||
[
|
describe "what I'm testing" [
|
||||||
(it "can add numbers" {
|
(it "can add numbers" {
|
||||||
actual = 2 + 2;
|
actual = 2 + 2;
|
||||||
expected = 4;
|
expected = 4;
|
||||||
|
|
11
mytest.nix
11
mytest.nix
|
@ -1,4 +1,9 @@
|
||||||
{it, ...}: [
|
{
|
||||||
|
describe,
|
||||||
|
it,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
describe "what I'm testing" [
|
||||||
(it "can add numbers" {
|
(it "can add numbers" {
|
||||||
actual = 2 + 2;
|
actual = 2 + 2;
|
||||||
expected = 4;
|
expected = 4;
|
||||||
|
@ -7,8 +12,8 @@
|
||||||
actual = 2 + 2;
|
actual = 2 + 2;
|
||||||
expected = 5;
|
expected = 5;
|
||||||
})
|
})
|
||||||
(it "won't throw a party" {
|
(it "throws a party" {
|
||||||
actual = "a party";
|
actual = throw "a party";
|
||||||
throws = true;
|
throws = true;
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
|
|
@ -26,9 +26,11 @@ msg: {
|
||||||
|
|
||||||
success =
|
success =
|
||||||
builtins.trace "testing if it ${msg}"
|
builtins.trace "testing if it ${msg}"
|
||||||
( if throws
|
(
|
||||||
|
if throws
|
||||||
then (builtins.tryEval actual).success == false
|
then (builtins.tryEval actual).success == false
|
||||||
else (a == e) );
|
else (a == e)
|
||||||
|
);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
inherit success msg;
|
inherit success msg;
|
||||||
|
|
Loading…
Reference in a new issue