Skip to content

Conversation

@mrnugget
Copy link
Contributor

@mrnugget mrnugget commented Dec 1, 2020

I started with one thought: "I just wish I had one test to make sure that this whole thing [the terminal UI] doesn't blow up every time I make a change" What I ended with is this. It includes a tiny VT100 "emulator".

And here's the kicker: I actually like this. It's fast to run and easy to extend and it gives me confidence that the basic rendering functionality works. Of course, the hacky injections need to be cleaned up before merging. And maybe we can get it to pass on Windows.

Opinions?

(This fixes https://github.com/sourcegraph/sourcegraph/issues/16330)

@mrnugget mrnugget requested a review from a team December 1, 2020 14:33
column int
}

func (t *ttyBuf) Write(b []byte) (int, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@mrnugget
Copy link
Contributor Author

mrnugget commented Dec 1, 2020

btw. I know that "test coverage" itself doesn't mean a lot, but with the latest commit this bumps the test coverage for campaign_progress_printer.go from 0% to 80%. That's pretty cool!

Copy link
Contributor

@LawnGnome LawnGnome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's hideous. I love it. ❤️

Copy link

@chrispine chrispine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool!

@mrnugget mrnugget merged commit 61ac68c into main Dec 2, 2020
@mrnugget mrnugget deleted the mrn/tui-integration-test branch December 2, 2020 10:55
scjohns pushed a commit that referenced this pull request Apr 24, 2023
* Hacky integration test for CampaignProgressPrinter

* Clean up ttyBuf

* Force width and height in integration test

* For now: skip on Windows

* Add completed diff to progress printer test

* Print again to make sure that the output is the same

* Sort filenames before printing diff summary

* Fix missing clearCurrentLine call

* Always create a new line on newline character

* Be more defensive in ttyBuf

* Use stable timestamps in test

* Clean up duplicated default opts

* Make handling of no-spinner consistent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Finish snapshot testing for TUI in src-cli

5 participants