summary refs log tree commit diff
path: root/lib/tests/misc.nix
diff options
context:
space:
mode:
authorGerg-L <GregLeyda@proton.me>2023-10-16 18:55:38 -0400
committerGerg-L <GregLeyda@proton.me>2023-10-16 20:29:28 -0400
commitd2161d06321770f37fd86bfa15296dd8de0196a0 (patch)
tree005f74e57ce8c07b06b1a6e058d51bae74dd6194 /lib/tests/misc.nix
parentd7c49ca7152768114a9359b729557f77b8343545 (diff)
downloadnixpkgs-d2161d06321770f37fd86bfa15296dd8de0196a0.tar
nixpkgs-d2161d06321770f37fd86bfa15296dd8de0196a0.tar.gz
nixpkgs-d2161d06321770f37fd86bfa15296dd8de0196a0.tar.bz2
nixpkgs-d2161d06321770f37fd86bfa15296dd8de0196a0.tar.lz
nixpkgs-d2161d06321770f37fd86bfa15296dd8de0196a0.tar.xz
nixpkgs-d2161d06321770f37fd86bfa15296dd8de0196a0.tar.zst
nixpkgs-d2161d06321770f37fd86bfa15296dd8de0196a0.zip
lib/tests: add tests for getExe' and getExe
Diffstat (limited to 'lib/tests/misc.nix')
-rw-r--r--lib/tests/misc.nix28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix
index 2e7fda2b1f8..47853f47278 100644
--- a/lib/tests/misc.nix
+++ b/lib/tests/misc.nix
@@ -1906,4 +1906,32 @@ runTests {
     expr = (with types; either int (listOf (either bool str))).description;
     expected = "signed integer or list of (boolean or string)";
   };
+
+# Meta
+  testGetExe'Output = {
+    expr = getExe' {
+      type = "derivation";
+      out = "somelonghash";
+      bin = "somelonghash";
+    } "executable";
+    expected = "somelonghash/bin/executable";
+  };
+
+  testGetExeOutput = {
+    expr = getExe {
+      type = "derivation";
+      out = "somelonghash";
+      bin = "somelonghash";
+      meta.mainProgram = "mainProgram";
+    };
+    expected = "somelonghash/bin/mainProgram";
+  };
+
+  testGetExe'FailureFirstArg = testingThrow (
+    getExe' "not a derivation" "executable"
+  );
+
+  testGetExe'FailureSecondArg = testingThrow (
+    getExe' { type = "derivation"; } "dir/executable"
+  );
 }