about summary refs log tree commit diff
path: root/pkgs/pkgs-lib/tests
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2022-04-04 13:11:47 +0200
committerRobert Hensing <robert@roberthensing.nl>2022-04-04 13:17:11 +0200
commitdcca8f5be287bf7efd4867d0e0ed7643434a8236 (patch)
tree181fe2e6bf8ff4cd15849b3764a2b99f6d59d1d3 /pkgs/pkgs-lib/tests
parentef6d9dfd710cf082b90aa78804f0743aa9b1a8a8 (diff)
tests.pkgs-lib.formats: Detect when impossible input is fed
Diffstat (limited to 'pkgs/pkgs-lib/tests')
-rw-r--r--pkgs/pkgs-lib/tests/formats.nix6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkgs/pkgs-lib/tests/formats.nix b/pkgs/pkgs-lib/tests/formats.nix
index 1efe9d8686b1d..99b88d36ec3c3 100644
--- a/pkgs/pkgs-lib/tests/formats.nix
+++ b/pkgs/pkgs-lib/tests/formats.nix
@@ -9,7 +9,11 @@ let
     let
       formatSet = format args;
       config = formatSet.type.merge [] (imap1 (n: def: {
-        value = def;
+        # We check the input values, so that
+        #  - we don't write nonsensical tests that will impede progress
+        #  - the test author has a slightly more realistic view of the
+        #    final format during development.
+        value = lib.throwIfNot (formatSet.type.check def) (builtins.trace def "definition does not pass the type's check function") def;
         file = "def${toString n}";
       }) [ def ]);
     in formatSet.generate "test-format-file" config;