Skip to content

Commit

Permalink
squash
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbou committed Feb 22, 2024
1 parent d4b75f6 commit 22dbd72
Showing 1 changed file with 54 additions and 11 deletions.
65 changes: 54 additions & 11 deletions tests/reftests/init-scripts.test
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,61 @@ No configuration file found, using built-in defaults.
[default] Initialised
### # we need the switch for variables file
### opam switch create fake --empty --root root
### find root/opam-init/*
### find root/opam-init/ | unordered
root/opam-init/
root/opam-init/complete.sh
root/opam-init/complete.zsh
root/opam-init/env_hook.csh
root/opam-init/env_hook.fish
root/opam-init/env_hook.sh
root/opam-init/env_hook.zsh
root/opam-init/hooks
root/opam-init/hooks/sandbox.sh
root/opam-init/hooks/sandbox.sh.hash
root/opam-init/init.cmd
root/opam-init/init.csh
root/opam-init/init.fish
root/opam-init/init.ps1
root/opam-init/init.sh
root/opam-init/init.zsh
root/opam-init/variables.cmd
root/opam-init/variables.csh
root/opam-init/variables.fish
root/opam-init/variables.ps1
root/opam-init/variables.sh
### : Init scripts :
### cat root/opam-init/init.sh
if [ -t 0 ]; then
test -r ${BASEDIR}/root/opam-init/complete.sh && . ${BASEDIR}/root/opam-init/complete.sh > /dev/null 2> /dev/null || true
test -r '${BASEDIR}/root/opam-init/complete.sh' && . '${BASEDIR}/root/opam-init/complete.sh' > /dev/null 2> /dev/null || true

test -r ${BASEDIR}/root/opam-init/env_hook.sh && . ${BASEDIR}/root/opam-init/env_hook.sh > /dev/null 2> /dev/null || true
test -r '${BASEDIR}/root/opam-init/env_hook.sh' && . '${BASEDIR}/root/opam-init/env_hook.sh' > /dev/null 2> /dev/null || true
fi

test -r ${BASEDIR}/root/opam-init/variables.sh && . ${BASEDIR}/root/opam-init/variables.sh > /dev/null 2> /dev/null || true
test -r '${BASEDIR}/root/opam-init/variables.sh' && . '${BASEDIR}/root/opam-init/variables.sh' > /dev/null 2> /dev/null || true
### cat root/opam-init/init.zsh
if [[ -o interactive ]]; then
[[ ! -r ${BASEDIR}/root/opam-init/complete.zsh ]] || source ${BASEDIR}/root/opam-init/complete.zsh > /dev/null 2> /dev/null
[[ ! -r '${BASEDIR}/root/opam-init/complete.zsh' ]] || source '${BASEDIR}/root/opam-init/complete.zsh' > /dev/null 2> /dev/null

[[ ! -r ${BASEDIR}/root/opam-init/env_hook.zsh ]] || source ${BASEDIR}/root/opam-init/env_hook.zsh > /dev/null 2> /dev/null
[[ ! -r '${BASEDIR}/root/opam-init/env_hook.zsh' ]] || source '${BASEDIR}/root/opam-init/env_hook.zsh' > /dev/null 2> /dev/null
fi

[[ ! -r ${BASEDIR}/root/opam-init/variables.sh ]] || source ${BASEDIR}/root/opam-init/variables.sh > /dev/null 2> /dev/null
[[ ! -r '${BASEDIR}/root/opam-init/variables.sh' ]] || source '${BASEDIR}/root/opam-init/variables.sh' > /dev/null 2> /dev/null
### cat root/opam-init/init.fish
if isatty
source ${BASEDIR}/root/opam-init/env_hook.fish > /dev/null 2> /dev/null; or true
source '${BASEDIR}/root/opam-init/env_hook.fish' > /dev/null 2> /dev/null; or true
end

source ${BASEDIR}/root/opam-init/variables.fish > /dev/null 2> /dev/null; or true
source '${BASEDIR}/root/opam-init/variables.fish' > /dev/null 2> /dev/null; or true
### cat root/opam-init/init.csh
if ( $?prompt ) then
if ( -f ${BASEDIR}/root/opam-init/env_hook.csh ) source ${BASEDIR}/root/opam-init/env_hook.csh >& /dev/null
if ( -f '${BASEDIR}/root/opam-init/env_hook.csh' ) source '${BASEDIR}/root/opam-init/env_hook.csh' >& /dev/null
endif

if ( -f ${BASEDIR}/root/opam-init/variables.csh ) source ${BASEDIR}/root/opam-init/variables.csh >& /dev/null
if ( -f '${BASEDIR}/root/opam-init/variables.csh' ) source '${BASEDIR}/root/opam-init/variables.csh' >& /dev/null
### cat root/opam-init/init.cmd
if exist "${BASEDIR}/root/opam-init/variables.cmd" call "${BASEDIR}/root/opam-init/variables.cmd" >NUL 2>NUL
### cat root/opam-init/init.ps1
. "${BASEDIR}/root/opam-init/variables.ps1" *> $null
### : Variables scripts :
### cat root/opam-init/variables.sh
# Prefix of the current opam switch
Expand Down Expand Up @@ -64,6 +89,20 @@ setenv MANPATH "$MANPATH":'${BASEDIR}/root/fake/man'
# Binary dir for opam switch fake
if ( ! ${?PATH} ) setenv PATH ""
setenv PATH '${BASEDIR}/root/fake/bin':"$PATH"
### cat root/opam-init/variables.cmd
:: Prefix of the current opam switch
set "OPAM_SWITCH_PREFIX=${BASEDIR}/root/fake"
:: Current opam switch man dir
set "MANPATH=%MANPATH%:${BASEDIR}/root/fake/man"
:: Binary dir for opam switch fake
set "PATH=${BASEDIR}/root/fake/bin:%PATH%"
### cat root/opam-init/variables.ps1
# Prefix of the current opam switch
$env:OPAM_SWITCH_PREFIX='${BASEDIR}/root/fake'
# Current opam switch man dir
$env:MANPATH="$env:MANPATH" + ':${BASEDIR}/root/fake/man'
# Binary dir for opam switch fake
$env:PATH='${BASEDIR}/root/fake/bin:' + "$env:PATH"
### : Env hook scripts :
### cat root/opam-init/env_hook.sh
OPAMNOENVNOTICE=true; export OPAMNOENVNOTICE;
Expand Down Expand Up @@ -93,3 +132,7 @@ end
if ( ! ${?OPAMNOENVNOTICE} ) setenv OPAMNOENVNOTICE ""
setenv OPAMNOENVNOTICE true
alias precmd 'eval `opam env --shell=csh --readonly`'
### test -f root/opam-init/env_hook.cmd
# Return code 1 #
### test -f root/opam-init/env_hook.ps1
# Return code 1 #

0 comments on commit 22dbd72

Please sign in to comment.