purebred-mua / tasty-tmux

Terminal user acceptance testing via tmux
GNU Affero General Public License v3.0
6 stars 0 forks source link

ANSI regex handling sucks. #5

Open frasertweedale opened 5 years ago

frasertweedale commented 5 years ago

The buildAnsiRegex helper is pretty nasty. How can it be improved? Do we will need it at all?

I'd also like to have a nice interface for referring to colours and attributes instead of magic stringified numbers that the user is somehow just expected to know. This will not be API-breaking stuff (additions, rather), so I'm not prioritising this.

romanofski commented 5 years ago

Yeah it turned out to be pretty handy a few times that I had included the colour attribute in the regular expression. I think it comes down to how specific you want to assert against: just the text output or the actual UI. When I bounced this back and forth in my head I'd rather stick with the UI even though it is more finicky.

Having said that (and not part of this card), I wonder how a declarative representation of the UI would be to assert against. The representation would be something like:

[80x42][blue] text title [bold][green] more text
frasertweedale commented 5 years ago

If tmux-2.4 is uncommon enough on current OSes we might be able to drop support for the regex hack entirely. Still want a nicer way of constructing them though, by refering to colours etc.

romanofski commented 5 years ago

Yes I agree using declarative colours is a needed improvement.