4 test-bash = callPackage (
15 runCommandLocal "patch-rc-path-bash-test"
25 description = "Package test of patchActivateBash";
26 inherit (patchRcPathBash.meta) maintainers;
33 # Check the setup hook script
35 echo "Running shellcheck against ${./test-sourcing-bash}"
36 shellcheck -s bash --exclude SC1090 ${./test-sourcing-bash}
37 shellcheck -s ksh --exclude SC1090 ${./test-sourcing-bash}
40 # Test patching a blank file
44 echo "Generating blank_patched.bash from blank.bash"
45 cp blank.bash blank_patched.bash
46 patchRcPathBash blank_patched.bash "$PWD/delta:$PWD/foxtrot"
48 echo "Running shellcheck against blank_patched.bash"
49 shellcheck -s bash blank_patched.bash
50 shellcheck -s ksh blank_patched.bash
52 echo "Testing in Bash if blank.bash and blank_patched.bash modifies PATH the same way"
53 bash ${./test-sourcing-bash} ./blank.bash ./blank_patched.bash
55 echo "Testing in Ksh if blank.bash and blank_patched.bash modifies PATH the same way"
56 ksh ${./test-sourcing-bash} "$PWD/blank.bash" "$PWD/blank_patched.bash"
58 echo "Testing in Zsh if blank.bash and blank_patched.bash modifies PATH the same way"
59 zsh ${./test-sourcing-bash} ./blank.bash ./blank_patched.bash
62 # Test patching silent_hello
64 echo "hello > /dev/null" > silent_hello.bash
66 echo "Generating silent_hello_patched.bash from silent_hello.bash"
67 cp silent_hello.bash silent_hello_patched.bash
68 patchRcPathBash silent_hello_patched.bash "${hello}/bin"
70 echo "Running shellcheck against silent_hello_patched.bash"
71 shellcheck -s bash silent_hello_patched.bash
73 echo "Testing in Bash if silent_hello_patched.bash get sourced without error"
74 bash -eu -o pipefail -c ". ./silent_hello_patched.bash"
76 echo "Testing in Ksh if silent_hello_patched.bash get sourced without error"
77 ksh -eu -o pipefail -c ". ./silent_hello_patched.bash"
79 echo "Testing in Zsh if silent_hello_patched.bash get sourced without error"
80 zsh -eu -o pipefail -c ". ./silent_hello_patched.bash"
83 # Check the sample source
85 echo "Running shellcheck against sample_source.bash"
86 shellcheck -s bash ${./sample_source.bash}
87 shellcheck -s ksh ${./sample_source.bash}
90 # Test patching the sample source
92 cp ${./sample_source.bash} sample_source_patched.bash
93 chmod u+w sample_source_patched.bash
95 echo "Generating sample_source_patched.bash from ./sample_source.bash"
96 patchRcPathBash sample_source_patched.bash "$PWD/delta:$PWD/foxtrot"
98 echo "Running shellcheck against sample_source_patched.bash"
99 shellcheck -s bash sample_source_patched.bash
101 echo "Testing in Bash if sample_source.bash and sample_source_patched.bash modifies PATH the same way"
102 bash ${./test-sourcing-bash} ${./sample_source.bash} ./sample_source_patched.bash
104 echo "Testing in Ksh if sample_source.bash and sample_source_patched.bash modifies PATH the same way"
105 ksh ${./test-sourcing-bash} ${./sample_source.bash} "$PWD/sample_source_patched.bash"
107 echo "Testing in Zsh if sample_source.bash and sample_source_patched.bash modifies PATH the same way"
108 zsh ${./test-sourcing-bash} ${./sample_source.bash} ./sample_source_patched.bash
111 # Test double-patching the sample source
113 echo "Patching again sample_source_patched.bash"
114 patchRcPathBash sample_source_patched.bash "$PWD/foxtrot:$PWD/golf"
116 echo "Running shellcheck against sample_source_patched.bash"
117 shellcheck -s bash sample_source_patched.bash
118 shellcheck -s ksh sample_source_patched.bash
120 echo "Testing in Bash if sample_source.bash and sample_source_patched.bash modifies PATH the same way"
121 bash ${./test-sourcing-bash} ${./sample_source.bash} ./sample_source_patched.bash
123 echo "Testing in Ksh if sample_source.bash and sample_source_patched.bash modifies PATH the same way"
124 ksh ${./test-sourcing-bash} ${./sample_source.bash} "$PWD/sample_source_patched.bash"
126 echo "Testing in Zsh if sample_source.bash and sample_source_patched.bash modifies PATH the same way"
127 zsh ${./test-sourcing-bash} ${./sample_source.bash} ./sample_source_patched.bash
130 # Create a dummy output
135 test-csh = callPackage (
144 runCommandLocal "patch-rc-path-csh-test"
146 nativeBuildInputs = [
151 description = "Package test of patchActivateCsh";
152 inherit (patchRcPathCsh.meta) maintainers;
159 # Test patching a blank file
163 echo "Generating blank_patched.csh from blank.csh"
164 cp blank.csh blank_patched.csh
165 patchRcPathCsh blank_patched.csh "$PWD/delta:$PWD/foxtrot"
167 echo "Testing in Csh if blank.csh and blank_patched.csh modifies PATH the same way"
168 tcsh -e ${./test-sourcing-csh} blank.csh blank_patched.csh
171 # Test patching silent_hello file
173 echo "hello > /dev/null" > silent_hello.csh
175 echo "Generating silent_hello_patched.csh from silent_hello.csh"
176 cp silent_hello.csh silent_hello_patched.csh
177 patchRcPathCsh silent_hello_patched.csh "${hello}/bin"
179 echo "Testing in Csh if silent_hello_patched.csh get sourced without errer"
180 tcsh -e -c "source silent_hello_patched.csh"
183 # Generate the sample source
185 substitute ${./sample_source.csh.in} sample_source.csh --replace @sed@ ${gnused}/bin/sed
186 chmod u+rw sample_source.csh
189 # Test patching the sample source
191 echo "Generating sample_source_patched.csh from sample_source.csh"
192 cp sample_source.csh sample_source_patched.csh
193 chmod u+w sample_source_patched.csh
194 patchRcPathCsh sample_source_patched.csh "$PWD/delta:$PWD/foxtrot"
196 echo "Testing in Csh if sample_source.csh and sample_source_patched.csh modifies PATH the same way"
197 tcsh -e ${./test-sourcing-csh} sample_source.csh sample_source_patched.csh
200 # Test double-patching the sample source
202 echo "Patching again sample_source_patched.csh from sample_source.csh"
203 patchRcPathCsh sample_source_patched.csh "$PWD/foxtrot:$PWD/golf"
205 echo "Testing in Csh if sample_source.csh and sample_source_patched.csh modifies PATH the same way"
206 tcsh -e ${./test-sourcing-csh} sample_source.csh sample_source_patched.csh
209 # Create a dummy output
214 test-fish = callPackage (
222 runCommandLocal "patch-rc-path-fish-test"
224 nativeBuildInputs = [
229 description = "Package test of patchActivateFish";
230 inherit (patchRcPathFish.meta) maintainers;
237 # Test patching a blank file
241 echo "Generating blank_patched.fish from blank.fish"
242 cp blank.fish blank_patched.fish
243 patchRcPathFish blank_patched.fish "$PWD/delta:$PWD/foxtrot"
245 echo "Testing in Fish if blank.fish and blank_patched.fish modifies PATH the same way"
246 HOME_TEMP="$(mktemp -d temporary_home_XXXXXX)"
247 HOME="$HOME_TEMP" fish ${./test-sourcing-fish} blank.fish blank_patched.fish
251 # Test patching silent_hello file
253 echo "hello > /dev/null" > silent_hello.fish
255 echo "Generating silent_hello_patched.fish from silent_hello.fish"
256 cp silent_hello.fish silent_hello_patched.fish
257 patchRcPathFish silent_hello_patched.fish "${hello}/bin"
259 echo "Testing in Fish if silent_hello_patched.fish get sourced without error"
260 HOME_TEMP="$(mktemp -d temporary_home_XXXXXX)"
261 HOME="$HOME_TEMP" fish -c "source silent_hello_patched.fish"
265 # Test patching the sample source
267 cp ${./sample_source.fish} sample_source_patched.fish
268 chmod u+w sample_source_patched.fish
270 echo "Generating sample_source_patched.fish from ${./sample_source.fish}"
271 patchRcPathFish sample_source_patched.fish "$PWD/delta:$PWD/foxtrot"
272 echo "Testing in Fish if sample_source.fish and sample_source_patched.fish modifies PATH the same way"
273 HOME_TEMP="$(mktemp -d temporary_home_XXXXXX)"
274 HOME="$HOME_TEMP" fish ${./test-sourcing-fish} ${./sample_source.fish} sample_source_patched.fish
278 # Test double-patching the sample source
280 echo "Patching again sample_source_patched.fish from ${./sample_source.fish}"
281 patchRcPathFish sample_source_patched.fish "$PWD/foxtrot:$PWD/golf"
283 echo "Testing in Fish if sample_source.fish and sample_source_patched.fish modifies PATH the same way"
284 HOME_TEMP="$(mktemp -d temporary_home_XXXXXX)"
285 HOME="$HOME_TEMP" fish ${./test-sourcing-fish} ${./sample_source.fish} sample_source_patched.fish
289 # Create a dummy output
294 test-posix = callPackage (
306 runCommandLocal "patch-rc-path-posix-test"
308 nativeBuildInputs = [
316 description = "Package test of patchActivatePosix";
317 inherit (patchRcPathPosix.meta) maintainers;
324 # Check the setup hook script
326 echo "Running shellcheck against ${./test-sourcing-posix}"
327 shellcheck -s sh --exclude SC1090 ${./test-sourcing-posix}
328 shellcheck -s dash --exclude SC1090 ${./test-sourcing-posix}
331 # Test patching a blank file
335 echo "Generating blank_patched.sh from blank.sh"
336 cp blank.sh blank_patched.sh
337 patchRcPathPosix blank_patched.sh "$PWD/delta:$PWD/foxtrot"
339 echo "Running shellcheck against blank_patched.sh"
340 shellcheck -s sh blank_patched.sh
341 shellcheck -s dash blank_patched.sh
343 echo "Testing in Bash if blank.sh and blank_patched.sh modifies PATH the same way"
344 bash --posix ${./test-sourcing-posix} ./blank.sh ./blank_patched.sh
346 echo "Testing in Dash if blank.sh and blank_patched.sh modifies PATH the same way"
347 dash ${./test-sourcing-posix} ./blank.sh ./blank_patched.sh
349 echo "Testing in Ksh if ./blank.sh and ./blank_patched.sh modifies PATH the same way"
350 ksh ${./test-sourcing-posix} "$PWD/blank.sh" "$PWD/blank_patched.sh"
353 # Test patching silent_hello file
355 echo "hello > /dev/null" > silent_hello.sh
357 echo "Generating silent_hello_patched.sh from silent_hello.sh"
358 cp silent_hello.sh silent_hello_patched.sh
359 patchRcPathPosix silent_hello_patched.sh "${hello}/bin"
361 echo "Running shellcheck against silent_hello_patched.sh"
362 shellcheck -s sh silent_hello_patched.sh
363 shellcheck -s dash silent_hello_patched.sh
365 echo "Testing in Bash if silent_hello_patched.sh get sourced without error"
366 bash --posix -eu -c ". ./silent_hello_patched.sh"
368 echo "Testing in Dash if silent_hello_patched.sh get sourced without error"
369 dash -eu -c ". ./silent_hello_patched.sh"
371 echo "Testing in Ksh if silent_hello_patched.sh get sourced without error"
372 ksh -eu -c ". $PWD/silent_hello_patched.sh"
375 # Generate the sample source "$PWD/delta:$PWD/foxtrot" "$PWD/delta:$PWD/foxtrot"
377 substitute ${./sample_source.sh.in} sample_source.sh --replace @sed@ ${gnused}/bin/sed
378 chmod u+rw sample_source.sh
381 # Check the sample source
383 echo "Running shellcheck against sample_source.sh"
384 shellcheck -s sh sample_source.sh
385 shellcheck -s dash sample_source.sh
388 # Test patching the sample source
390 echo "Generating sample_source_patched.sh from sample_source.sh"
391 cp sample_source.sh sample_source_patched.sh
392 chmod u+w sample_source_patched.sh
393 patchRcPathPosix sample_source_patched.sh "$PWD/delta:$PWD/foxtrot"
395 echo "Running shellcheck against sample_source_patched.sh"
396 shellcheck -s sh sample_source_patched.sh
397 shellcheck -s dash sample_source_patched.sh
399 echo "Testing in Bash if sample_source.bash and sample_source_patched.bash modifies PATH the same way"
400 bash --posix ${./test-sourcing-posix} "./sample_source.sh" "./sample_source_patched.sh"
402 echo "Testing in Dash if sample_source.sh and sample_source_patched.sh modifies PATH the same way"
403 dash ${./test-sourcing-posix} "./sample_source.sh" "./sample_source_patched.sh"
405 echo "Testing in Ksh if sample_source.sh and sample_source_patched.sh modifies PATH the same way"
406 ksh ${./test-sourcing-posix} "$PWD/sample_source.sh" "$PWD/sample_source_patched.sh"
409 # Test double-patching the sample source
411 echo "Patching again sample_source_patched.sh"
412 patchRcPathPosix sample_source_patched.sh "$PWD/foxtrot:$PWD/golf"
414 echo "Running shellcheck against sample_source_patched.sh"
415 shellcheck -s sh sample_source_patched.sh
416 shellcheck -s dash sample_source_patched.sh
418 echo "Testing in Bash if sample_source.bash and sample_source_patched.bash modifies PATH the same way"
419 bash --posix ${./test-sourcing-posix} "./sample_source.sh" "./sample_source_patched.sh"
421 echo "Testing in Dash if sample_source.sh and sample_source_patched.sh modifies PATH the same way"
422 dash ${./test-sourcing-posix} "./sample_source.sh" "./sample_source_patched.sh"
424 echo "Testing in Ksh if sample_source.sh and sample_source_patched.sh modifies PATH the same way"
425 ksh ${./test-sourcing-posix} "$PWD/sample_source.sh" "$PWD/sample_source_patched.sh"
428 # Create a dummy output