diff options
author | Robert Hensing <robert@roberthensing.nl> | 2022-06-25 13:53:02 +0200 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2022-09-21 10:55:07 +0100 |
commit | fce8b018f06431e7684b725a520416ff3862db9f (patch) | |
tree | 13b1b9abc56f15abd169bb2f321cddabefd7de6d /lib/tests/misc.nix | |
parent | 0615155dab4a29b4188097841249586eb5ade442 (diff) | |
download | nixpkgs-fce8b018f06431e7684b725a520416ff3862db9f.tar nixpkgs-fce8b018f06431e7684b725a520416ff3862db9f.tar.gz nixpkgs-fce8b018f06431e7684b725a520416ff3862db9f.tar.bz2 nixpkgs-fce8b018f06431e7684b725a520416ff3862db9f.tar.lz nixpkgs-fce8b018f06431e7684b725a520416ff3862db9f.tar.xz nixpkgs-fce8b018f06431e7684b725a520416ff3862db9f.tar.zst nixpkgs-fce8b018f06431e7684b725a520416ff3862db9f.zip |
lib: Add lazyDerivation
Diffstat (limited to 'lib/tests/misc.nix')
-rw-r--r-- | lib/tests/misc.nix | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix index 9b1397a7915..74020bc7c8e 100644 --- a/lib/tests/misc.nix +++ b/lib/tests/misc.nix @@ -1207,6 +1207,59 @@ runTests { expected = true; }; + # lazyDerivation + + testLazyDerivationIsLazyInDerivationForAttrNames = { + expr = attrNames (lazyDerivation { + derivation = throw "not lazy enough"; + }); + # It's ok to add attribute names here when lazyDerivation is improved + # in accordance with its inline comments. + expected = [ "drvPath" "meta" "name" "out" "outPath" "outputName" "outputs" "system" "type" ]; + }; + + testLazyDerivationIsLazyInDerivationForPassthruAttr = { + expr = (lazyDerivation { + derivation = throw "not lazy enough"; + passthru.tests = "whatever is in tests"; + }).tests; + expected = "whatever is in tests"; + }; + + testLazyDerivationIsLazyInDerivationForPassthruAttr2 = { + # passthru.tests is not a special case. It works for any attr. + expr = (lazyDerivation { + derivation = throw "not lazy enough"; + passthru.foo = "whatever is in foo"; + }).foo; + expected = "whatever is in foo"; + }; + + testLazyDerivationIsLazyInDerivationForMeta = { + expr = (lazyDerivation { + derivation = throw "not lazy enough"; + meta = "whatever is in meta"; + }).meta; + expected = "whatever is in meta"; + }; + + testLazyDerivationReturnsDerivationAttrs = let + derivation = { + type = "derivation"; + outputs = ["out"]; + out = "test out"; + outPath = "test outPath"; + outputName = "out"; + drvPath = "test drvPath"; + name = "test name"; + system = "test system"; + meta = "test meta"; + }; + in { + expr = lazyDerivation { inherit derivation; }; + expected = derivation; + }; + testTypeDescriptionInt = { expr = (with types; int).description; expected = "signed integer"; |