コード例 #1
0
 def test_4(self, bash):
     got = assert_bash_exec(
         bash,
         '_muttconffiles "$HOME/muttrc" "$HOME/muttrc"',
         want_output=True).strip().split()
     assert got == ["%s/mutt/%s" % (bash.cwd, x) for x in
                    ("muttrc", "bar/muttrc_b", "foo/muttrc_f")]
コード例 #2
0
 def _test_part_full(self, bash, part, full):
     res = assert_bash_exec(
         bash,
         '_tilde "~%s"; echo "${COMPREPLY[@]}"' % part,
         want_output=True,
     ).strip().split()
     assert res
     assert res[0] == "~%s" % full
コード例 #3
0
 def test_3(self, bash):
     """~part should complete to ~full<SPACE> if home dir does not exist."""
     res = assert_bash_exec(
         bash, "for u in $(compgen -u); do "
         "eval test -d ~$u || echo $u; unset u; done",
         want_output=True).strip().split()
     part_full = find_unique_completion_pair(res)
     if not part_full:
         pytest.skip("No suitable test user found")
         return
     part, full = part_full
     completion = assert_complete(bash, "ls ~%s" % part)
     assert completion.list == ["~%s" % full]
     assert completion.line.endswith(" ")
コード例 #4
0
 def test_1(self, bash):
     assert_bash_exec(bash, "_expand >/dev/null")
コード例 #5
0
 def test_16(self, bash):
     """a b::| with WORDBREAKS -= : should return b::"""
     assert_bash_exec(bash, "add_comp_wordbreak_char :")
     output = self._test(bash, "(a b::)", 1, "a b::", 5, arg=":")
     assert output == "b::"
コード例 #6
0
 def test_11(self, bash):
     assert_bash_exec(bash,
                      "fn() { echo ----; echo ---foo; echo '----- bar'; }")
     output = assert_bash_exec(bash, "_parse_usage fn")
     assert not output
コード例 #7
0
 def test_1(self, bash):
     assert_bash_exec(bash, "_get_comp_words_by_ref cur >/dev/null")
コード例 #8
0
 def test_1(self, bash):
     assert_bash_exec(bash, "_tilde >/dev/null")
コード例 #9
0
 def test_7(self, bash):
     assert_bash_exec(bash, "fn() { echo '[-s, --long=arg]'; }")
     output = assert_bash_exec(bash, "_parse_usage fn", want_output=True)
     assert output.split() == "--long=".split()
コード例 #10
0
 def test_3(self, bash):
     assert_bash_exec(bash, "fn() { echo 'internal-dash'; }")
     output = assert_bash_exec(bash, "_parse_help fn")
     assert not output
コード例 #11
0
 def test_4(self, bash):
     assert_bash_exec(bash, "fn() { echo 'no -leading-dashes'; }")
     output = assert_bash_exec(bash, "_parse_help fn")
     assert not output
コード例 #12
0
 def test_29(self, bash):
     """Test parsing from stdin."""
     output = assert_bash_exec(bash,
                               "echo '-f or --foo' | _parse_help -",
                               want_output=True)
     assert output.split() == "--foo".split()
コード例 #13
0
 def test_30(self, bash):
     """More than two dashes should not be treated as options."""
     assert_bash_exec(
         bash, r"fn() { printf '%s\n' $'----\n---foo\n----- bar'; }")
     output = assert_bash_exec(bash, "_parse_help fn")
     assert not output
コード例 #14
0
 def test_24(self, bash):
     assert_bash_exec(bash, "fn() { echo '-[dont]x --[dont]yy'; }")
     output = assert_bash_exec(bash, "_parse_help fn", want_output=True)
     assert output.split() == "--yy --dontyy".split()
コード例 #15
0
 def test_23(self, bash):
     assert_bash_exec(bash, "fn() { echo '--[dont-]foo'; }")
     output = assert_bash_exec(bash, "_parse_help fn", want_output=True)
     assert output.split() == "--foo --dont-foo".split()
コード例 #16
0
 def test_22(self, bash):
     assert_bash_exec(bash, "fn() { echo '--[no-]bar=quux'; }")
     output = assert_bash_exec(bash, "_parse_help fn", want_output=True)
     assert output.split() == "--bar= --no-bar=".split()
コード例 #17
0
 def test_1(self, bash):
     """Test environment non-pollution, detected at teardown."""
     assert_bash_exec(
         bash, 'foo() { local cur prev words cword; _init_completion; }; '
         'foo; unset foo')
コード例 #18
0
 def test_6(self, bash):
     assert_bash_exec(bash, "fn() { echo ' -space dash'; }")
     output = assert_bash_exec(bash, "_parse_help fn", want_output=True)
     assert output.split() == "-space".split()
コード例 #19
0
 def test_3(self, bash):
     """Test for https://bugs.debian.org/766163"""
     assert_bash_exec(bash, '_tilde ~-o')
コード例 #20
0
 def test_9(self, bash):
     assert_bash_exec(bash, "fn() { echo '-one dash-inside'; }")
     output = assert_bash_exec(bash, "_parse_help fn", want_output=True)
     assert output.split() == "-one".split()
コード例 #21
0
 def test_3(self, bash):
     assert_bash_exec(bash, "fn() { echo 'foo [-f]'; }")
     output = assert_bash_exec(bash, "_parse_usage fn", want_output=True)
     assert output.split() == "-f".split()
コード例 #22
0
 def test_10(self, bash):
     """Test value not included in completion."""
     assert_bash_exec(bash, "fn() { echo '--long-arg=value'; }")
     output = assert_bash_exec(bash, "_parse_help fn", want_output=True)
     assert output.split() == "--long-arg=".split()
コード例 #23
0
 def test_9(self, bash):
     assert_bash_exec(bash, "fn() { echo '[ -a ] [ -b foo ]'; }")
     output = assert_bash_exec(bash, "_parse_usage fn", want_output=True)
     assert output.split() == "-a -b".split()
コード例 #24
0
 def test_11(self, bash):
     """Test -value not seen as option."""
     assert_bash_exec(bash, "fn() { echo '--long-arg=-value'; }")
     output = assert_bash_exec(bash, "_parse_help fn", want_output=True)
     assert output.split() == "--long-arg=".split()
コード例 #25
0
 def test_1(self, bash):
     assert_bash_exec(bash, "fn() { echo; }")
     output = assert_bash_exec(bash, "_parse_usage fn")
     assert not output
コード例 #26
0
 def test_12(self, bash):
     """a b:c| with WORDBREAKS += : should return c"""
     assert_bash_exec(bash, "add_comp_wordbreak_char :")
     output = self._test(bash, "(a b : c)", 3, "a b:c", 5)
     assert output == "c"
コード例 #27
0
 def test_1(self, bash):
     assert_bash_exec(bash, "_count_args >/dev/null")
コード例 #28
0
 def test_16(self, bash):
     assert_bash_exec(bash, "fn() { echo '-f, -F, --foo'; }")
     output = assert_bash_exec(bash, "_parse_help fn", want_output=True)
     assert output.split() == "--foo".split()
コード例 #29
0
 def test_12(self, bash):
     assert_bash_exec(bash, "fn() { echo '--long-arg=-value,--opt2=val'; }")
     output = assert_bash_exec(bash, "_parse_help fn", want_output=True)
     assert output.split() == "--long-arg=".split()
コード例 #30
0
 def test_14(self, bash):
     """a b c:| with WORDBREAKS -= : should return c:"""
     assert_bash_exec(bash, "add_comp_wordbreak_char :")
     output = self._test(bash, "(a b c :)", 3, "a b c:", 6, arg=":")
     assert output == "c:"
コード例 #31
0
 def test_15(self, bash):
     assert_bash_exec(bash, "fn() { echo '-T|--upload-file'; }")
     output = assert_bash_exec(bash, "_parse_help fn", want_output=True)
     assert output.split() == "--upload-file".split()
コード例 #32
0
 def test_13(self, bash):
     assert_bash_exec(bash, "fn() { echo '-m,--mirror'; }")
     output = assert_bash_exec(bash, "_parse_help fn", want_output=True)
     assert output.split() == "--mirror".split()
コード例 #33
0
 def test_18(self, bash):
     assert_bash_exec(bash, "fn() { echo '--foo=<bar>'; }")
     output = assert_bash_exec(bash, "_parse_help fn", want_output=True)
     assert output.split() == "--foo=".split()
コード例 #34
0
 def test_15(self, bash):
     assert_bash_exec(bash, "fn() { echo '-T|--upload-file'; }")
     output = assert_bash_exec(bash, "_parse_help fn", want_output=True)
     assert output.split() == "--upload-file".split()
コード例 #35
0
 def test_1(self, bash):
     assert_bash_exec(bash, "_ip_addresses")
コード例 #36
0
 def test_16(self, bash):
     assert_bash_exec(bash, "fn() { echo '-f, -F, --foo'; }")
     output = assert_bash_exec(bash, "_parse_help fn", want_output=True)
     assert output.split() == "--foo".split()
コード例 #37
0
 def test_2(self, bash):
     """Test environment non-pollution, detected at teardown."""
     assert_bash_exec(
         bash,
         'foo() { local aa="~"; _tilde "$aa"; }; foo; unset foo')
コード例 #38
0
 def test_1(self, bash):
     assert_bash_exec(bash, "fn() { echo; }")
     output = assert_bash_exec(bash, "_parse_help fn")
     assert not output
コード例 #39
0
 def test_18(self, bash):
     assert_bash_exec(bash, "fn() { echo '--foo=<bar>'; }")
     output = assert_bash_exec(bash, "_parse_help fn", want_output=True)
     assert output.split() == "--foo=".split()
コード例 #40
0
 def test_1(self, bash):
     assert_bash_exec(bash, "COMP_CWORD= _count_args >/dev/null")
コード例 #41
0
 def test_2(self, bash):
     assert_bash_exec(bash, "fn() { echo 'no dashes here'; }")
     output = assert_bash_exec(bash, "_parse_usage fn")
     assert not output
コード例 #42
0
 def test_1(self, bash, completion):
     hosts = assert_bash_exec(bash, "compgen -A hostname",
                              want_output=True).split()
     assert all(x in completion for x in hosts)
     assert "lftptest" in completion  # defined in lftp/.lftp/bookmarks
コード例 #43
0
 def test_4(self, bash):
     assert_bash_exec(bash, "fn() { echo 'bar [-aBcD] [-e X]'; }")
     output = assert_bash_exec(bash, "_parse_usage fn", want_output=True)
     assert output.split() == "-a -B -c -D -e".split()
コード例 #44
0
 def test_2(self, bash):
     assert_bash_exec(bash, "fn() { echo 'no dashes here'; }")
     output = assert_bash_exec(bash, "_parse_usage fn")
     assert not output
コード例 #45
0
 def test_8(self, bash):
     assert_bash_exec(bash, "fn() { echo '[--long/-s] [-S/--longer]'; }")
     output = assert_bash_exec(bash, "_parse_usage fn", want_output=True)
     assert output.split() == "--long --longer".split()
コード例 #46
0
 def test_3(self, bash):
     assert_bash_exec(bash, "fn() { echo 'foo [-f]'; }")
     output = assert_bash_exec(bash, "_parse_usage fn", want_output=True)
     assert output.split() == "-f".split()
コード例 #47
0
 def test_10(self, bash):
     assert_bash_exec(bash, "fn() { echo '[ -a | --aa ]'; }")
     output = assert_bash_exec(bash, "_parse_usage fn", want_output=True)
     assert output.split() == "--aa".split()
コード例 #48
0
 def test_4(self, bash):
     assert_bash_exec(bash, "fn() { echo 'bar [-aBcD] [-e X]'; }")
     output = assert_bash_exec(bash, "_parse_usage fn", want_output=True)
     assert output.split() == "-a -B -c -D -e".split()
コード例 #49
0
 def test_12(self, bash):
     output = assert_bash_exec(
         bash, "echo '[-duh]' | _parse_usage -", want_output=True)
     assert output.split() == "-d -u -h".split()
コード例 #50
0
 def test_7(self, bash):
     assert_bash_exec(bash, "fn() { echo '[-s, --long=arg]'; }")
     output = assert_bash_exec(bash, "_parse_usage fn", want_output=True)
     assert output.split() == "--long=".split()
コード例 #51
0
 def _test(self, bash, *args, **kwargs):
     assert_bash_exec(bash, "unset cur prev")
     output = self._test_unit(
         "_get_comp_words_by_ref %s cur prev; echo $cur,$prev",
         bash, *args, **kwargs)
     return output.strip()
コード例 #52
0
 def test_8(self, bash):
     assert_bash_exec(bash, "fn() { echo '[--long/-s] [-S/--longer]'; }")
     output = assert_bash_exec(bash, "_parse_usage fn", want_output=True)
     assert output.split() == "--long --longer".split()
コード例 #53
0
 def test_17(self, bash):
     """a b:c| with WORDBREAKS += :"""
     assert_bash_exec(bash, "add_comp_wordbreak_char :")
     output = self._test(bash, "(a b : c)", 3, "a b:c", 5)
     assert output == "c,:"
コード例 #54
0
 def test_9(self, bash):
     assert_bash_exec(bash, "fn() { echo '[ -a ] [ -b foo ]'; }")
     output = assert_bash_exec(bash, "_parse_usage fn", want_output=True)
     assert output.split() == "-a -b".split()
コード例 #55
0
 def test_2(self, bash):
     """Test environment non-pollution, detected at teardown."""
     assert_bash_exec(
         bash, 'foo() { _expand; }; foo; unset foo')
コード例 #56
0
 def test_10(self, bash):
     assert_bash_exec(bash, "fn() { echo '[ -a | --aa ]'; }")
     output = assert_bash_exec(bash, "_parse_usage fn", want_output=True)
     assert output.split() == "--aa".split()
コード例 #57
0
 def test_1(self, bash, completion):
     hosts = assert_bash_exec(
         bash, "compgen -A hostname", want_output=True).split()
     for host in hosts:
         assert host in completion.list
     assert "lftptest" in completion.list  # defined in lftp/.lftp/bookmarks
コード例 #58
0
 def test_13(self, bash):
     assert_bash_exec(bash, "fn() { echo '-m,--mirror'; }")
     output = assert_bash_exec(bash, "_parse_help fn", want_output=True)
     assert output.split() == "--mirror".split()
コード例 #59
0
 def test_1(self, bash, completion):
     users = sorted(assert_bash_exec(
         bash, "compgen -A user", want_output=True).split())
     assert completion.list == users
コード例 #60
0
 def test_1(self, bash):
     assert_bash_exec(bash, "_get_cword >/dev/null")