diff options
Diffstat (limited to 'nix')
-rw-r--r-- | nix/tag/default.nix | 2 | ||||
-rw-r--r-- | nix/tag/tests.nix | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/nix/tag/default.nix b/nix/tag/default.nix index 0038404460b1..2955656323fa 100644 --- a/nix/tag/default.nix +++ b/nix/tag/default.nix @@ -78,7 +78,7 @@ let # Like `discrDef`, but fail if there is no match. discr = fs: v: let res = discrDef null fs v; in - assert lib.assertMsg (res != null) + assert lib.assertMsg (res != { }) "tag.discr: No predicate found that matches ${lib.generators.toPretty {} v}"; res; diff --git a/nix/tag/tests.nix b/nix/tag/tests.nix index bcc42c758a6c..e0085b4837a1 100644 --- a/nix/tag/tests.nix +++ b/nix/tag/tests.nix @@ -4,6 +4,7 @@ let inherit (depot.nix.runTestsuite) runTestsuite assertEq + assertThrows it ; @@ -50,6 +51,10 @@ let { int = lib.isInt; } ] "foo") { def = "foo"; }) + (assertThrows "throws failing to match" + (discr [ + { fish = x: x == 42; } + ] 21)) ]; match-test = it "can match things" [ |