Skip to content

Commit

Permalink
test: Don't include our magic mark in completions
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed Jul 1, 2018
1 parent ff4289f commit d8712ad
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions test/t/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,20 @@ def completion(request, bash: pexpect.spawn) -> CompletionResult:
pexpect.TIMEOUT,
])
if got == 0:
line = bash.before
if line.endswith(MAGIC_MARK):
line = bash.before[:-len(MAGIC_MARK)]
result = CompletionResult(
bash.before,
[x for x in re.split(r" {2,}|\r\n", bash.before) if x],
line,
[x for x in re.split(r" {2,}|\r\n", line) if x],
)
elif got == 2:
line = bash.after
if line.endswith(MAGIC_MARK):
line = bash.after[:-len(MAGIC_MARK)]
result = CompletionResult(
bash.after,
shlex.split(cmd + bash.after)[-1],
line,
shlex.split(cmd + line)[-1],
)
else:
# TODO: warn about EOF/TIMEOUT?
Expand Down

0 comments on commit d8712ad

Please sign in to comment.