about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--nix/runTestsuite/default.nix7
1 files changed, 7 insertions, 0 deletions
diff --git a/nix/runTestsuite/default.nix b/nix/runTestsuite/default.nix
index 18206b67d8e9..5bb0ce1f8511 100644
--- a/nix/runTestsuite/default.nix
+++ b/nix/runTestsuite/default.nix
@@ -61,6 +61,7 @@ let
       should-throw = struct "should-throw" {
         expr = any;
       };
+      unexpected-throw = struct "unexpected-throw" { };
     };
 
   # The result of an assert,
@@ -119,6 +120,11 @@ let
       in
         assertBoolContext context desc (throws expr));
 
+  # assert that the expression does not throw when `deepSeq`-ed
+  assertDoesNotThrow = defun [ string any AssertResult ]
+    (desc: expr:
+      assertBoolContext { unexpected-throw = { }; } desc (!(throws expr)));
+
   # Annotate a bunch of asserts with a descriptive name
   it = desc: asserts: {
     it-desc = desc;
@@ -171,6 +177,7 @@ in {
   inherit
     assertEq
     assertThrows
+    assertDoesNotThrow
     it
     runTestsuite
     ;