diff options
Diffstat (limited to 'test/t/unit/test_unit_unlocal.py')
-rw-r--r-- | test/t/unit/test_unit_unlocal.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/t/unit/test_unit_unlocal.py b/test/t/unit/test_unit_unlocal.py new file mode 100644 index 0000000..be5ec56 --- /dev/null +++ b/test/t/unit/test_unit_unlocal.py @@ -0,0 +1,18 @@ +import pytest + +from conftest import assert_bash_exec + + +@pytest.mark.bashcomp(cmd=None, ignore_env=r"^\+(VAR=|declare -f foo)") +class TestUnlocal: + def test_1(self, bash): + cmd = ( + "foo() { " + "local VAR=inner; " + "_comp_unlocal VAR; " + "echo $VAR; " + "}; " + "VAR=outer; foo; " + ) + res = assert_bash_exec(bash, cmd, want_output=True).strip() + assert res == "outer" |