home
·
contact
·
privacy
projects
/
ircplom
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5178b85
)
To testing add "just_enter" prompt directive to handle pre-filled prompts.
master
author
Plom Heller
<plom@plomlompom.com>
Fri, 6 Mar 2026 04:16:25 +0000
(
05:16
+0100)
committer
Plom Heller
<plom@plomlompom.com>
Fri, 6 Mar 2026 04:16:25 +0000
(
05:16
+0100)
src/ircplom/testing.py
patch
|
blob
|
history
diff --git
a/src/ircplom/testing.py
b/src/ircplom/testing.py
index 92c8ea6bce9090ac3114757c86abca46a7d26f16..53b06c98bd129f70d2a320f122f02865208e3cef 100644
(file)
--- a/
src/ircplom/testing.py
+++ b/
src/ircplom/testing.py
@@
-34,6
+34,8
@@
_TOK_FILE = './'
_TOK_IDX_REPEAT = 'r'
_KW_BUMP = 'bump='
_KW_RANGE = 'range='
_TOK_IDX_REPEAT = 'r'
_KW_BUMP = 'bump='
_KW_RANGE = 'range='
+_PROMPT_RAISE_SIGWINCH = 'raise_sigwinch'
+_PROMPT_JUST_ENTER = 'just_enter'
_SIGNATURE_FOR_CMD = {
_MARK_FRAGMENT: (1, None),
_SIGNATURE_FOR_CMD = {
_MARK_FRAGMENT: (1, None),
@@
-448,15
+450,17
@@
class _Playbook:
def _play_till_test(self) -> None:
while True:
if self._idx >= len(self._lines_t):
def _play_till_test(self) -> None:
while True:
if self._idx >= len(self._lines_t):
- self._lines_t += [('',
'>
/quit'),
- ('',
'log
0 <..')]
+ self._lines_t += [('',
f'{_MARK_PROMPT}
/quit'),
+ ('',
f'{_MARK_LOG}
0 <..')]
cmd_name, args = self._cmdname_and_args_from(self._current_line[1])
if cmd_name == _MARK_PROMPT:
assert self.put_keypress is not None
cmd_name, args = self._cmdname_and_args_from(self._current_line[1])
if cmd_name == _MARK_PROMPT:
assert self.put_keypress is not None
- if args[0] ==
'raise_sigwinch'
:
+ if args[0] ==
_PROMPT_RAISE_SIGWINCH
:
args = ('',)
self._lines_t[self._idx:self._idx + 1] = [('', '> ')]
raise_signal(SIGWINCH)
args = ('',)
self._lines_t[self._idx:self._idx + 1] = [('', '> ')]
raise_signal(SIGWINCH)
+ elif args[0] == _PROMPT_JUST_ENTER:
+ args = ('',)
for c in args[0]:
self.put_keypress(c)
self.put_keypress('KEY_ENTER')
for c in args[0]:
self.put_keypress(c)
self.put_keypress('KEY_ENTER')
@@
-554,5
+558,6
@@
class TestingClientTui(ClientTui):
def cmd__prompt_enter(self) -> None:
def test_before(cmd_name: str, args: tuple[str, ...]) -> None:
assert cmd_name == _MARK_PROMPT
def cmd__prompt_enter(self) -> None:
def test_before(cmd_name: str, args: tuple[str, ...]) -> None:
assert cmd_name == _MARK_PROMPT
- assert args[0] == self.window.prompt.input_buffer[:]
+ if args[0] != _PROMPT_JUST_ENTER:
+ assert args[0] == self.window.prompt.input_buffer
self._playbook.test_wrap(test_before, None, super().cmd__prompt_enter)
self._playbook.test_wrap(test_before, None, super().cmd__prompt_enter)