Skip to content

test(Makefile.am): update EXTRA_DIST in Makefile.am #794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions test/t/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ EXTRA_DIST = \
test_apt_build.py \
test_apt_cache.py \
test_apt_get.py \
test_apt_mark.py \
test_aptitude.py \
test_arch.py \
test_arp.py \
Expand Down Expand Up @@ -256,6 +257,7 @@ EXTRA_DIST = \
test_ip.py \
test_ipcalc.py \
test_iperf.py \
test_iperf3.py \
test_ipmitool.py \
test_ipsec.py \
test_iptables.py \
Expand Down
7 changes: 7 additions & 0 deletions test/t/unit/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
EXTRA_DIST = \
test_unit_command_offset.py \
test_unit_count_args.py \
test_unit_deprecate_func.py \
test_unit_dequote.py \
test_unit_expand.py \
test_unit_expand_glob.py \
test_unit_expand_tilde_by_ref.py \
test_unit_filedir.py \
test_unit_find_unique_completion_pair.py \
Expand All @@ -10,6 +14,7 @@ EXTRA_DIST = \
test_unit_ip_addresses.py \
test_unit_known_hosts_real.py \
test_unit_longopt.py \
test_unit_looks_like_path.py \
test_unit_parse_help.py \
test_unit_parse_usage.py \
test_unit_pgids.py \
Expand All @@ -18,7 +23,9 @@ EXTRA_DIST = \
test_unit_quote.py \
test_unit_quote_readline.py \
test_unit_tilde.py \
test_unit_unlocal.py \
test_unit_variables.py \
test_unit_xfunc.py \
test_unit_xinetd_services.py

all:
Expand Down
79 changes: 28 additions & 51 deletions test/t/unit/test_unit_expand_glob.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,101 +6,78 @@
@pytest.mark.bashcomp(
cmd=None,
cwd="_filedir",
ignore_env=r"^\+(my_array=|declare -f dump_array$)",
ignore_env=r"^\+declare -f (dump_array|__tester)$",
)
class TestExpandGlob:
def test_match_all(self, bash):
@pytest.fixture(scope="class")
def functions(self, bash):
assert_bash_exec(
bash,
"dump_array() { ((${#my_array[@]})) && printf '<%s>' \"${my_array[@]}\"; echo; }",
"dump_array() { ((${#arr[@]})) && printf '<%s>' \"${arr[@]}\"; echo; }",
)
output = assert_bash_exec(
assert_bash_exec(
bash,
"LC_ALL= LC_COLLATE=C _comp_expand_glob my_array '*';dump_array",
want_output=True,
'__tester() { local LC_ALL= LC_COLLATE=C arr; _comp_expand_glob arr "$@";dump_array; }',
)

def test_match_all(self, bash, functions):
output = assert_bash_exec(bash, "__tester '*'", want_output=True)
assert output.strip() == "<a b><a$b><a&b><a'b><ab><aé><brackets><ext>"

def test_match_pattern(self, bash):
output = assert_bash_exec(
bash,
"LC_ALL= LC_COLLATE=C _comp_expand_glob my_array 'a*';dump_array",
want_output=True,
)
def test_match_pattern(self, bash, functions):
output = assert_bash_exec(bash, "__tester 'a*'", want_output=True)
assert output.strip() == "<a b><a$b><a&b><a'b><ab><aé>"

def test_match_unmatched(self, bash):
def test_match_unmatched(self, bash, functions):
output = assert_bash_exec(
bash,
"_comp_expand_glob my_array 'unmatched-*';dump_array",
want_output=True,
bash, "__tester 'unmatched-*'", want_output=True
)
assert output.strip() == ""

def test_match_multiple_words(self, bash):
output = assert_bash_exec(
bash,
"_comp_expand_glob my_array 'b* e*';dump_array",
want_output=True,
)
def test_match_multiple_words(self, bash, functions):
output = assert_bash_exec(bash, "__tester 'b* e*'", want_output=True)
assert output.strip() == "<brackets><ext>"

def test_match_brace_expansion(self, bash):
def test_match_brace_expansion(self, bash, functions):
output = assert_bash_exec(
bash,
"_comp_expand_glob my_array 'brac{ket,unmatched}*';dump_array",
want_output=True,
bash, "__tester 'brac{ket,unmatched}*'", want_output=True
)
assert output.strip() == "<brackets>"

def test_protect_from_noglob(self, bash):
with bash_env_saved(bash) as bash_env:
def test_protect_from_noglob(self, bash, functions):
with bash_env_saved(bash, functions) as bash_env:
bash_env.set("noglob", True)
output = assert_bash_exec(
bash,
"LC_ALL= LC_COLLATE=C _comp_expand_glob my_array 'a*';dump_array",
want_output=True,
)
output = assert_bash_exec(bash, "__tester 'a*'", want_output=True)
assert output.strip() == "<a b><a$b><a&b><a'b><ab><aé>"

def test_protect_from_failglob(self, bash):
def test_protect_from_failglob(self, bash, functions):
with bash_env_saved(bash) as bash_env:
bash_env.shopt("failglob", True)
output = assert_bash_exec(
bash,
"_comp_expand_glob my_array 'unmatched-*';dump_array",
want_output=True,
bash, "__tester 'unmatched-*'", want_output=True
)
assert output.strip() == ""

def test_protect_from_nullglob(self, bash):
def test_protect_from_nullglob(self, bash, functions):
with bash_env_saved(bash) as bash_env:
bash_env.shopt("nullglob", False)
output = assert_bash_exec(
bash,
"_comp_expand_glob my_array 'unmatched-*';dump_array",
want_output=True,
bash, "__tester 'unmatched-*'", want_output=True
)
assert output.strip() == ""

def test_protect_from_dotglob(self, bash):
def test_protect_from_dotglob(self, bash, functions):
with bash_env_saved(bash) as bash_env:
bash_env.shopt("dotglob", True)
output = assert_bash_exec(
bash,
"_comp_expand_glob my_array 'ext/foo/*';dump_array",
want_output=True,
bash, "__tester 'ext/foo/*'", want_output=True
)
assert output.strip() == ""

def test_protect_from_GLOBIGNORE(self, bash):
def test_protect_from_GLOBIGNORE(self, bash, functions):
with bash_env_saved(bash) as bash_env:
# Note: dotglob is changed by GLOBIGNORE
bash_env.save_shopt("dotglob")
bash_env.write_variable("GLOBIGNORE", "*")
output = assert_bash_exec(
bash,
"LC_ALL= LC_COLLATE=C _comp_expand_glob my_array 'a*';dump_array",
want_output=True,
)
output = assert_bash_exec(bash, "__tester 'a*'", want_output=True)
assert output.strip() == "<a b><a$b><a&b><a'b><ab><aé>"