1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-06-09 09:36:20 +09:00

lib: add xor

This gets clumsily reimplemented in various places, to no useful end.
This commit is contained in:
edef 2024-04-04 14:05:18 +00:00
parent d03a448222
commit 725bb4e48c
12 changed files with 49 additions and 38 deletions

View file

@ -102,6 +102,7 @@ let
types
updateManyAttrsByPath
versions
xor
;
testingThrow = expr: {
@ -210,6 +211,21 @@ runTests {
expected = false;
};
testXor = {
expr = [
(xor true false)
(xor true true)
(xor false false)
(xor false true)
];
expected = [
true
false
false
true
];
};
testFix = {
expr = fix (x: {a = if x ? a then "a" else "b";});
expected = {a = "a";};