about summary refs log tree commit diff
path: root/pkgs/by-name/ju
diff options
context:
space:
mode:
authorLászló Vaskó <1771332+vlaci@users.noreply.github.com>2024-06-06 13:30:41 +0200
committerLászló Vaskó <1771332+vlaci@users.noreply.github.com>2024-06-06 17:05:21 +0200
commit8d548d61ec95cc01efa14206f78eb2f8b593aaf8 (patch)
treeeeb87bb153f6d691ec290dce1f610e87f611ea48 /pkgs/by-name/ju
parent21ea0e48c85bd1b674aa77b295b6c727419e9211 (diff)
just: make new bash completion test work from build
Diffstat (limited to 'pkgs/by-name/ju')
-rw-r--r--pkgs/by-name/ju/just/fix-just-path-in-tests.patch20
-rw-r--r--pkgs/by-name/ju/just/package.nix9
2 files changed, 29 insertions, 0 deletions
diff --git a/pkgs/by-name/ju/just/fix-just-path-in-tests.patch b/pkgs/by-name/ju/just/fix-just-path-in-tests.patch
new file mode 100644
index 0000000000000..63587ebc698aa
--- /dev/null
+++ b/pkgs/by-name/ju/just/fix-just-path-in-tests.patch
@@ -0,0 +1,20 @@
+diff --git a/tests/completions/just.bash b/tests/completions/just.bash
+index 6d5c12c..13bff87 100755
+--- a/tests/completions/just.bash
++++ b/tests/completions/just.bash
+@@ -17,11 +17,13 @@ reply_equals() {
+   fi
+ }
+ 
++just() {
++  cargo run -- "$@"
++}
++
+ # --- Initial Setup ---
+ source "$1"
+ cd tests/completions
+-cargo build
+-PATH="$(git rev-parse --show-toplevel)/target/debug:$PATH"
+ exit_code=0
+ 
+ # --- Tests ---
diff --git a/pkgs/by-name/ju/just/package.nix b/pkgs/by-name/ju/just/package.nix
index a8b66340ec22a..1a24bd46d8fc8 100644
--- a/pkgs/by-name/ju/just/package.nix
+++ b/pkgs/by-name/ju/just/package.nix
@@ -2,6 +2,7 @@
 , stdenv
 , fetchFromGitHub
 , rustPlatform
+, bashInteractive
 , coreutils
 , installShellFiles
 , libiconv
@@ -42,8 +43,16 @@ rustPlatform.buildRustPackage rec {
 
     # Return unchanged string.rs
     cp $TMPDIR/string.rs tests/string.rs
+
+    # For shell completion tests
+    export PATH=${bashInteractive}/bin:$PATH
+    patchShebangs tests
   '';
 
+  patches = [
+    ./fix-just-path-in-tests.patch
+  ];
+
   postBuild = ''
     cargo run --package generate-book