bandwhich: 0.23.0 -> 0.23.1; move to by-name; nixfmt; useFetchCargoVendor (#356934)
[NixPkgs.git] / pkgs / build-support / setup-hooks / patch-rc-path-hooks / test / test-sourcing-bash
blob1b6cc54d8f93e28de227e89298df0f596ea614d0
1 #!/usr/bin/env bash
3 set -eu -o pipefail
5 UNPATCHED_SOURCE_FILE="$1"
6 PATCHED_SOURCE_FILE="$2"
7 ORIG_PATH="$PWD/alfa:$PWD/bravo"
8 RESULT_PATH_FROM_UNPATCHED="$(
9 PATH="$ORIG_PATH"; export PATH
10 . "$UNPATCHED_SOURCE_FILE"
11 echo "$PATH"
13 RESULT_PATH_FROM_PATCHED="$(
14 PATH="$ORIG_PATH"; export PATH
15 . "$PATCHED_SOURCE_FILE"
16 echo "$PATH"
18 if [[ "$RESULT_PATH_FROM_UNPATCHED" != "$RESULT_PATH_FROM_PATCHED" ]]; then
19 echo "Result path mismatched: $UNPATCHED_SOURCE_FILE ($RESULT_PATH_FROM_UNPATCHED) and $PATCHED_SOURCE_FILE ($RESULT_PATH_FROM_PATCHED)" >&2
20 exit 1