varabyte / kotter

A declarative, Kotlin-idiomatic API for writing dynamic console applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add a test for Terminal#width

bitspittle opened this issue · comments

See issue #95 which happened because I was lax about overriding the width value for native terminals.

At this point, I'm fairly confident width logic works right because I have so much existing code using this feature. But it would be really nice, still, to have a test for it.

Step 1) Allow passing the width value into TestTerminal
Step 2) Write a few tests to stress / verify long lines render / repaint as expected.

Actually, this is nastier than I thought. To support this, you'd have to reimplement terminal virtual code handling in the test terminal (since it would need to know how long lines are, with control codes removed, so that it can append newlines at the right place). This would turn the intentionally simple and dumb TestTerminal class into something a bit more sophisticated.

This is doable but honestly probably not worth it. Going to close this out for now. A few users and I tested Terminal#width behavior across all the different platforms and it's working, so consider that an integration test :)