-
-
Notifications
You must be signed in to change notification settings - Fork 166
Add and expand bind -x READLINE_*
env var tests
#2299
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this!
Good questions about the terminal size ...
Actually I noticed that too, before I read your initial comments
I don't have a strong opinion right now, but I do think it's nice to be able to set those in tests
I suggested MAYBE the @register
params, but is that useful?
I guess we could also do parameterized tests, like @register(dims=[(80, 24), (10, 5)])
to test very small terminals
Although IMO one issue with pexpect
is that it is hard to debug test failures! I was doing that the other day, related to job control and Ctrl-Z
and fg
and such
Nevertheless, the tests are VERY useful, because they did catch a bug I introduced, before commiting!
So thanks for getting these tests to work, it looks very useful
This looks good, let me rebuild the Docker image for the And then let's see if this passes, and then we can think about the lines/columns interface a bit more |
Using @registerI think Parameterized dims is (probably) overkill. I think testing with tiny dims will cause a lot of tests to fail, but I think that says more about the tests than anything else. Most tests just won't be expecting random newlines, but it's not really an interesting failure, right? OTOH, it might be useful for testing things like table/column layouts? I think you'd know better. Setting at command-lineIs this worth keeping? If we set dims for individual tests, what's the value of overriding the global default? If we want to use CLI opts to run only some tests with multiple dims, we need to either waste time rerunning tests we don't care about, or write extra code to avoid that. |
Woohoo, I added pyte and the tests pass now! |
Hm one thing I don't like is using Basically you want to initialize this, to the same values the
So yeah maybe we can have (We could also be ambitious and add a I think it is at least nice to set the dimensions to i.e. that |
I do think the flags can be useful -- actually for completion there was a bug when typing past the last column, and having the dimensions be controllable is nice |
OK, I'll keep the CLI flags, and make sure they're actually used here. How do you want to proceed with the dims? |
The tests look like
now So one idea is:
That seems possible? It won't break the other tests, because you pass 2 params only if it needs dimensions. So we only set It's possible there's something simpler that will suffice, but this doesn't seem too far away from what we have? |
OK, I can add that when I get a moment. |
Also simplify interactive bind tests
Pyright hates '\C' being used over '\\C' for bind sequences
Adds --num-lines and --num-columns to test opts READLINE_POINT bind -x test now uses the LINES and COLUMNS env vars
…ests needing term dimensions
88b4997
to
96030d5
Compare
OK, I've updated it. Latest changes
The amount of extra info being stuck in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thank you!
Summary
This adds automatic interactive tests of the READLINE_* env vars for
bind -x
.Changes
setecho
--num-lines
and--num-columns
optsAreas I'd like feedback on
Term Dimensions
In order to use pyte, it requires size params to emulate a terminal of given dimensions. pexpect defaults to 24 lines X 80 columns, which is fine, but it doesn't expose that anywhere (otherwise I would have used it).
How should we set, and share, the dimension info, which is needed by both pexpect and pyte?
Alternatives
harness.py
- worked, but global state is ehhh...I went with 4. I'm not sold on the use of the LINES and COLUMNS env vars to communicate the dimensions to the interactive tests, but all the alternatives seemed worse.
I added the opts for the lines/columns in case anyone wanted to set them at a higher-level, but if you think that's unnecessary clutter, I can remove them.