Skip to content

Commit 40f582a

Browse files
committed
test(assert_complete): support systems with OLDPWD being unset
1 parent 013140c commit 40f582a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/t/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ def assert_complete(
499499
if cwd:
500500
assert_bash_exec(
501501
bash,
502-
"_bash_completion_test_OLDPWD=$OLDPWD;cd %s"
502+
"[[ ! ${OLDPWD+set} ]] || _bash_completion_test_OLDPWD=$OLDPWD;cd %s"
503503
% shlex.quote(str(cwd)),
504504
want_output=None,
505505
)
@@ -567,7 +567,7 @@ def assert_complete(
567567
if cwd:
568568
assert_bash_exec(
569569
bash,
570-
"cd -;OLDPWD=$_bash_completion_test_OLDPWD",
570+
"cd -;if [[ ${_bash_completion_test_OLDPWD+set} ]]; then OLDPWD=$_bash_completion_test_OLDPWD; else unset -v OLDPWD; fi",
571571
want_output=None,
572572
)
573573
return result

0 commit comments

Comments
 (0)