From 44e647cac0a6d692473711bf6c6ce348690eb002 Mon Sep 17 00:00:00 2001 From: tristan Date: Tue, 2 Jan 2024 13:55:51 +0000 Subject: [PATCH] use describe in docs --- README.md | 4 ++-- mytest.nix | 11 ++++++++--- tix/it.nix | 10 ++++++---- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b063c07..ddabb7a 100644 --- a/README.md +++ b/README.md @@ -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; diff --git a/mytest.nix b/mytest.nix index 28c47a3..c59d798 100644 --- a/mytest.nix +++ b/mytest.nix @@ -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; }) ] diff --git a/tix/it.nix b/tix/it.nix index dc6e74e..e94eb61 100644 --- a/tix/it.nix +++ b/tix/it.nix @@ -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;