Skip to content

Commit

Permalink
test(hook): test case to cover bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Yohe-Am committed Jan 20, 2024
1 parent 2f2b2c3 commit a01690c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ import {
import dummy from "../ports/dummy.ts";
import type { InstallConfigFat } from "../port.ts";

// avoid using single quotes in this script
const posixInteractiveScript = `
set -eux
[ "$DUMMY_ENV" = "dummy" ] || exit 101
dummy
# it should be avail in subshells
sh -c '[ "$DUMMY_ENV" = "dummy" ]' || exit 105
sh -c "dummy"
pushd ../
# it shouldn't be avail here
[ $(set +e; dummy) ] && exit 102
Expand Down Expand Up @@ -59,7 +62,6 @@ ${line}
]
.join("\n");

// avoid using single quotes in this script
const posixNonInteractiveScript = `
set -eux
Expand All @@ -68,6 +70,10 @@ ghjk_reload
[ "$DUMMY_ENV" = "dummy" ] || exit 101
dummy
# it should be avail in subshells
sh -c '[ "$DUMMY_ENV" = "dummy" ]' || exit 105
sh -c "dummy"
pushd ../
# no reload so it's stil avail
dummy
Expand All @@ -94,6 +100,10 @@ const fishScript = `
dummy; or exit 101
test $DUMMY_ENV = "dummy"; or exit 102
# it should be avail in subshells
sh -c '[ "$DUMMY_ENV" = "dummy" ]'; or exit 105
sh -c "dummy"
pushd ../
# it shouldn't be avail here
which dummy; and exit 103
Expand Down

0 comments on commit a01690c

Please sign in to comment.