diff options
author | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2022-03-06 12:58:17 -0500 |
---|---|---|
committer | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2022-03-06 12:58:17 -0500 |
commit | 9d114fbd59ca30a67150421292d57db39d158649 (patch) | |
tree | 7f312a030711871a3b3b080d76704dd5a29da38a /test | |
parent | c41b93e768014e2a3d3d6376b78e790333451076 (diff) | |
download | nextbin-9d114fbd59ca30a67150421292d57db39d158649.tar.xz nextbin-9d114fbd59ca30a67150421292d57db39d158649.zip |
add test for duplicate path element
Diffstat (limited to 'test')
-rwxr-xr-x | test/start | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -24,15 +24,16 @@ check() { try() { # shellcheck disable=SC2016 - printf 'TEST: PATH="$PATH:%s" %s, expect %s\n' "$@" + printf 'TEST: PATH="%s:$PATH:%s" %s, expect %s\n' "${PWD%/test}" "$@" PATH="$PATH:$1" "$2" 2>&1 | check "$3" # shellcheck disable=SC2016 - printf 'TEST: PATH="%s:$PATH" %s, expect %s\n' "$@" + printf 'TEST: PATH="%s:%s:$PATH" %s, expect %s\n' "${PWD%/test}" "$@" PATH="$1:$PATH" "$2" 2>&1 | check "$3" } do_try() { try "$1" "$2/x" "$3" + try "$1" "$2//x" "$3" try "$1" "./$2/x" "$3" try "$1" "$PWD/$2/x" "$3" try "$1" "$2/../$2/x" "$3" @@ -41,12 +42,13 @@ do_try() { echo } +# use do_try2 if x in PATH do_try2() { try "$1" "x" "$3" do_try "$@" } -export PATH="$PWD/..:$PATH" +export PATH="${PWD%/test}:$PATH" do_try "" a "a err" do_try2 "$PWD/a" a "a err" @@ -55,5 +57,6 @@ do_try2 "$PWD/a:$PWD/b" a "a b err" do_try "$PWD/a:$PWD/b" b "b err" do_try2 "$PWD/a:$PWD/b:$PWD/c" a "a b c" do_try "$PWD/a:$PWD/b:$PWD/c" b "b c" +do_try2 "$PWD/a:$PWD/a" a "a err" echo "ALL TESTS COMPLETED SUCCESSFULLY :)" |