diff --git a/lib/tests/check-eval.nix b/lib/tests/check-eval.nix deleted file mode 100644 index 2ef7580e5857e..0000000000000 --- a/lib/tests/check-eval.nix +++ /dev/null @@ -1,10 +0,0 @@ -# Throws an error if any of our lib tests fail. - -let - tests = [ - "misc" - "systems" - ]; - all = builtins.concatLists (map (f: import (./. + "/${f}.nix")) tests); -in -if all == [ ] then null else throw (builtins.toJSON all) diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix index d9a72b29f2f43..b30ae32b23303 100644 --- a/lib/tests/misc.nix +++ b/lib/tests/misc.nix @@ -145,6 +145,11 @@ let inherit expected; }; + dummyDerivation = derivation { + name = "name"; + builder = "builder"; + system = "system"; + }; in runTests { @@ -757,18 +762,8 @@ runTests { }; testSplitStringsDerivation = { - expr = take 3 ( - strings.splitString "/" (derivation { - name = "name"; - builder = "builder"; - system = "system"; - }) - ); - expected = [ - "" - "nix" - "store" - ]; + expr = lib.dropEnd 1 (strings.splitString "/" dummyDerivation); + expected = strings.splitString "/" builtins.storeDir; }; testSplitVersionSingle = { @@ -816,7 +811,7 @@ runTests { in { storePath = isStorePath goodPath; - storePathDerivation = isStorePath (import ../.. { system = "x86_64-linux"; }).hello; + storePathDerivation = isStorePath dummyDerivation; storePathAppendix = isStorePath "${goodPath}/bin/python"; nonAbsolute = isStorePath (concatStrings (tail (stringToCharacters goodPath))); asPath = isStorePath (/. + goodPath); @@ -901,7 +896,7 @@ runTests { }; testHasInfixDerivation = { - expr = hasInfix "hello" (import ../.. { system = "x86_64-linux"; }).hello; + expr = hasInfix "name" dummyDerivation; expected = true; }; diff --git a/lib/tests/test-with-nix.nix b/lib/tests/test-with-nix.nix index ebbe5e0ae5cdf..4fc65010b8787 100644 --- a/lib/tests/test-with-nix.nix +++ b/lib/tests/test-with-nix.nix @@ -18,8 +18,6 @@ pkgs.runCommand "nixpkgs-lib-tests-nix-${nix.version}" { buildInputs = [ - (import ./check-eval.nix) - (import ./fetchers.nix) (import ../path/tests { inherit pkgs; }) @@ -71,6 +69,12 @@ pkgs.runCommand "nixpkgs-lib-tests-nix-${nix.version}" echo "Running lib/tests/systems.nix" [[ $(nix-instantiate --eval --strict lib/tests/systems.nix | tee /dev/stderr) == '[ ]' ]]; + echo "Running lib/tests/misc.nix" + [[ $(nix-instantiate --eval --strict lib/tests/misc.nix | tee /dev/stderr) == '[ ]' ]]; + + echo "Running lib/tests/fetchers.nix" + [[ $(nix-instantiate --eval --strict lib/tests/fetchers.nix | tee /dev/stderr) == '[ ]' ]]; + mkdir $out echo success > $out/${nix.version} ''