Author: NicolasPierron
Date: Wed Mar 30 11:18:10 2011
New Revision: 26600
URL: https://svn.nixos.org/websvn/nix/?rev=26600&sc=1
Log:
Add mkAssert.
Modified:
nixpkgs/trunk/pkgs/lib/properties.nix
Modified: nixpkgs/trunk/pkgs/lib/properties.nix
==============================================================================
--- nixpkgs/trunk/pkgs/lib/properties.nix Wed Mar 30 10:02:23 2011
(r26599)
+++ nixpkgs/trunk/pkgs/lib/properties.nix Wed Mar 30 11:18:10 2011
(r26600)
@@ -223,6 +223,11 @@
content = mkNotdef;
};
+ mkAssert = assertion: message: content:
+ mkIf
+ (if assertion then true else throw "\nFailed assertion: ${message}")
+ content;
+
# Remove all "If" statement defined on a value.
rmIf = foldProperty (
foldFilter isIf
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits