From c8848afe79cd5e33e01b955f1e36e5be5aaab9de Mon Sep 17 00:00:00 2001 From: Hugo LAMY Date: Wed, 22 Dec 2021 12:36:25 +0100 Subject: [PATCH] resolution tests pwd dans false positive --- tests/defaults/b_cd.sh | 5 ---- tests/defaults/b_cd_home.sh | 8 +++++ tests/defaults/b_echo.sh | 10 +++---- tests/defaults/b_pwd.sh | 55 ---------------------------------- tests/false_positive.sh | 60 +++++++++++++++++++++++++++++++++++++ unitests.sh | 4 +-- 6 files changed, 75 insertions(+), 67 deletions(-) diff --git a/tests/defaults/b_cd.sh b/tests/defaults/b_cd.sh index f8bc868..274dfa3 100644 --- a/tests/defaults/b_cd.sh +++ b/tests/defaults/b_cd.sh @@ -43,8 +43,6 @@ cd ~ cd ../Desktop -cd - cd poep mkdir dir @@ -80,9 +78,6 @@ pwd cd hello world pwd -cd / -pwd - cd / cd ../../akjwyefgjkwveyjfgweyugyuwegf76t273/../../ pwd diff --git a/tests/defaults/b_cd_home.sh b/tests/defaults/b_cd_home.sh index 62516bd..54f2f61 100644 --- a/tests/defaults/b_cd_home.sh +++ b/tests/defaults/b_cd_home.sh @@ -10,3 +10,11 @@ pwd export HOME=/ cd pwd + +export HOME="not_a_path" +cd +pwd + +export HOME="~/Desktop" +cd +pwd diff --git a/tests/defaults/b_echo.sh b/tests/defaults/b_echo.sh index 85ab7dd..3199c8a 100644 --- a/tests/defaults/b_echo.sh +++ b/tests/defaults/b_echo.sh @@ -21,15 +21,13 @@ echo echo echo working -echo - echo a -echo tab - echo " tab " -echo tab +echo tab + +echo space echo hello world @@ -94,3 +92,5 @@ echo hello echo "$ $ $ $ $ $ " echo $ + +echo "$''" diff --git a/tests/defaults/b_pwd.sh b/tests/defaults/b_pwd.sh index 92edb10..18bdbe6 100644 --- a/tests/defaults/b_pwd.sh +++ b/tests/defaults/b_pwd.sh @@ -63,61 +63,6 @@ echo $OLDPWD export PWD= export OLDPWD= -mkdir dir -cd dir -rmdir ../dir -cd ./ -pwd -echo $PWD -echo $OLDPWD -export PWD= -export OLDPWD= - -mkdir dir -cd dir -rmdir ../dir -cd ./ -cd ././././././//////////./././././././//////./ -pwd -echo $PWD -echo $OLDPWD -export PWD= -export OLDPWD= - -mkdir dir -cd dir -rmdir ../dir -cd ./ -cd ../ -pwd -echo $PWD -echo $OLDPWD -export PWD= -export OLDPWD= - -mkdir dir -ln -s dir link -cd link -rmdir ../dir -cd ./ -pwd -echo $PWD -echo $OLDPWD -export PWD= -export OLDPWD= - -mkdir dir -ln -s dir link -cd link -rmdir ../dir -cd ./ -cd ../ -pwd -echo $PWD -echo $OLDPWD -export PWD= -export OLDPWD= - mkdir DIR cd dir rmdir ../DIR diff --git a/tests/false_positive.sh b/tests/false_positive.sh index 43385a3..20dd61e 100644 --- a/tests/false_positive.sh +++ b/tests/false_positive.sh @@ -10,6 +10,66 @@ cat Makefile | grep pr | head -n 5 | hello (NA) echo $? + +#--------------------------------------------- +# pwd dans un dossier qui n'existe pas ne s'affiche pas + +mkdir dir +cd dir +rmdir ../dir +cd ./ +pwd +echo $PWD +echo $OLDPWD +export PWD= +export OLDPWD= + +mkdir dir +cd dir +rmdir ../dir +cd ./ +cd ././././././//////////./././././././//////./ +pwd +echo $PWD +echo $OLDPWD +export PWD= +export OLDPWD= + +mkdir dir +cd dir +rmdir ../dir +cd ./ +cd ../ +pwd +echo $PWD +echo $OLDPWD +export PWD= +export OLDPWD= + +mkdir dir +ln -s dir link +cd link +rmdir ../dir +cd ./ +pwd +echo $PWD +echo $OLDPWD +export PWD= +export OLDPWD= + +mkdir dir +ln -s dir link +cd link +rmdir ../dir +cd ./ +cd ../ +pwd +echo $PWD +echo $OLDPWD +export PWD= +export OLDPWD= + + #--------------------------------------------- # export PWD et OLDPWD ne dependent pas des meme action que bash # (dans bash : cd ne creer pas PWD, et OLDPWD n'existe que si PWD existe) diff --git a/unitests.sh b/unitests.sh index d264278..48a2468 100644 --- a/unitests.sh +++ b/unitests.sh @@ -61,8 +61,8 @@ cd $(dirname $0) # default list of files to be use - DEFAULT_FILES="$( find $DEFAULT_DIR | tail -n+2 )" - DEFAULT_FILES_USAGE="$( find $DEFAULT_DIR_USAGE | tail -n+2 )" + DEFAULT_FILES="$( find $DEFAULT_DIR -type f ! -iname ".*" -iname "*.sh" )" + DEFAULT_FILES_USAGE="$( find $DEFAULT_DIR_USAGE -type f ! -iname ".*" -iname "*.sh" )" # move project to a temp file mkdir -p tmp