use describe in docs

This commit is contained in:
tristan 2024-01-02 13:55:51 +00:00
parent 32a3950d16
commit 44e647cac0
3 changed files with 16 additions and 9 deletions

View file

@ -8,8 +8,8 @@ Test your Nix is only ticks.
Make a test file:
```mytest.nix
{ it, ... }:
[
{ describe, it, ... }:
describe "what I'm testing" [
(it "can add numbers" {
actual = 2 + 2;
expected = 4;

View file

@ -1,4 +1,9 @@
{it, ...}: [
{
describe,
it,
...
}:
describe "what I'm testing" [
(it "can add numbers" {
actual = 2 + 2;
expected = 4;
@ -7,8 +12,8 @@
actual = 2 + 2;
expected = 5;
})
(it "won't throw a party" {
actual = "a party";
(it "throws a party" {
actual = throw "a party";
throws = true;
})
]

View file

@ -25,10 +25,12 @@ msg: {
else v;
success =
builtins.trace "testing if it ${msg}"
( if throws
then (builtins.tryEval actual).success == false
else (a == e) );
builtins.trace "testing if it ${msg}"
(
if throws
then (builtins.tryEval actual).success == false
else (a == e)
);
in
{
inherit success msg;