mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
inttests: add ability to manipulate environment for a single test
This commit is contained in:
parent
d66ca10a0c
commit
e046d151a2
1 changed files with 5 additions and 2 deletions
7
test.sh
7
test.sh
|
|
@ -7,6 +7,7 @@ declare -i SUCCEDED=0
|
||||||
declare -i TODTODO=0
|
declare -i TODTODO=0
|
||||||
declare -i RAN=0
|
declare -i RAN=0
|
||||||
NAME=""
|
NAME=""
|
||||||
|
EXTRAENV=""
|
||||||
MINISHELL=$PWD/minishell
|
MINISHELL=$PWD/minishell
|
||||||
|
|
||||||
report_header()
|
report_header()
|
||||||
|
|
@ -71,8 +72,9 @@ when_run()
|
||||||
rm -rf /tmp/dir.minishell
|
rm -rf /tmp/dir.minishell
|
||||||
mkdir -p /tmp/dir.minishell
|
mkdir -p /tmp/dir.minishell
|
||||||
pushd /tmp/dir.minishell > /dev/null
|
pushd /tmp/dir.minishell > /dev/null
|
||||||
$MINISHELL &> /tmp/got.minishell < /tmp/input.minishell
|
env $EXTRAENV $MINISHELL &> /tmp/got.minishell < /tmp/input.minishell
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
|
EXTRAENV=""
|
||||||
RAN+=1
|
RAN+=1
|
||||||
NAME=$1
|
NAME=$1
|
||||||
}
|
}
|
||||||
|
|
@ -188,7 +190,8 @@ minishell: cd: Permission denied
|
||||||
/tmp/dir.minishell
|
/tmp/dir.minishell
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
HOME=/tmp/dir.minishell/fakehome when_run <<EOF "cd with no arguments goes to \$HOME"
|
EXTRAENV="HOME=/tmp/dir.minishell/fakehome"
|
||||||
|
when_run <<EOF "cd with no arguments goes to \$HOME"
|
||||||
mkdir fakehome
|
mkdir fakehome
|
||||||
cd
|
cd
|
||||||
pwd
|
pwd
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue