Mercurial > public > mercurial-scm > hg-stable
diff tests/test-commandserver.t @ 40639:83e571ea06a9
commandserver: attach prompt default and choices to message
These attributes are important to provide a GUI prompt to user.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 04 Nov 2018 12:17:20 +0900 |
parents | c49283e740da |
children | 6f0941f4a184 |
line wrap: on
line diff
--- a/tests/test-commandserver.t Thu Nov 08 22:25:04 2018 +0900 +++ b/tests/test-commandserver.t Sun Nov 04 12:17:20 2018 +0900 @@ -619,6 +619,10 @@ > @command(b"debugprompt", norepo=True) > def debugprompt(ui): > ui.write(b"%s\n" % ui.prompt(b"prompt:")) + > @command(b"debugpromptchoice", norepo=True) + > def debugpromptchoice(ui): + > msg = b"promptchoice (y/n)? $$ &Yes $$ &No" + > ui.write(b"%d\n" % ui.promptchoice(msg)) > @command(b"debugreadstdin", norepo=True) > def debugreadstdin(ui): > ui.write(b"read: %r\n" % sys.stdin.read(1)) @@ -751,6 +755,24 @@ message: '\xa2DdataOchecking files\nDtypeFstatus' message: '\xa2DdataX/checked 0 changesets with 0 changes to 0 files\nDtypeFstatus' + >>> from hgclient import checkwith, readchannel, runcommand, stringio + >>> @checkwith(extraargs=[b'--config', b'ui.message-output=channel', + ... b'--config', b'cmdserver.message-encodings=cbor', + ... b'--config', b'extensions.dbgui=dbgui.py']) + ... def prompt(server): + ... readchannel(server) + ... interactive = [b'--config', b'ui.interactive=True'] + ... runcommand(server, [b'debugprompt'] + interactive, + ... input=stringio(b'5678\n')) + ... runcommand(server, [b'debugpromptchoice'] + interactive, + ... input=stringio(b'n\n')) + *** runcommand debugprompt --config ui.interactive=True + message: '\xa3DdataGprompt:GdefaultAyDtypeFprompt' + 5678 + *** runcommand debugpromptchoice --config ui.interactive=True + message: '\xa4Gchoices\x82\x82AyCYes\x82AnBNoDdataTpromptchoice (y/n)? GdefaultAyDtypeFprompt' + 1 + bad message encoding: $ hg serve --cmdserver pipe --config ui.message-output=channel