diff options
author | Martin Weinelt <hexa@darmstadt.ccc.de> | 2022-09-28 17:15:11 +0200 |
---|---|---|
committer | Martin Weinelt <hexa@darmstadt.ccc.de> | 2022-09-28 17:15:11 +0200 |
commit | 7da8d25d8727b0f54f4918196b1ba13d946486b6 (patch) | |
tree | 7adcef207df68aa7483af231bd1c9e4367472a71 /lib/tests/misc.nix | |
parent | 7ddee326c2b49e0da7d96801fa703fe884455871 (diff) | |
parent | 530b2323c94597d1f7efe2c8ceaf46ec2e026e9b (diff) | |
download | nixpkgs-7da8d25d8727b0f54f4918196b1ba13d946486b6.tar nixpkgs-7da8d25d8727b0f54f4918196b1ba13d946486b6.tar.gz nixpkgs-7da8d25d8727b0f54f4918196b1ba13d946486b6.tar.bz2 nixpkgs-7da8d25d8727b0f54f4918196b1ba13d946486b6.tar.lz nixpkgs-7da8d25d8727b0f54f4918196b1ba13d946486b6.tar.xz nixpkgs-7da8d25d8727b0f54f4918196b1ba13d946486b6.tar.zst nixpkgs-7da8d25d8727b0f54f4918196b1ba13d946486b6.zip |
Merge remote-tracking branch 'origin/master' into staging-next
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"; |