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:
parent
d03a448222
commit
725bb4e48c
12 changed files with 49 additions and 38 deletions
|
@ -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";};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue