tview
tview copied to clipboard
Box: add tests
That PR is prototype for creating the tests. Tests run in parallel for minimaze test time. For check - run in console:
go test -v -cover
Output:
$ go test -v -cover
=== RUN TestBox
=== RUN TestBox/box.Simple
=== PAUSE TestBox/box.Simple
=== RUN TestBox/box.Bold.Border
=== PAUSE TestBox/box.Bold.Border
=== RUN TestBox/box.AlignLeft
=== PAUSE TestBox/box.AlignLeft
=== RUN TestBox/box.AlignRight
=== PAUSE TestBox/box.AlignRight
=== RUN TestBox/box.AlignCenter
=== PAUSE TestBox/box.AlignCenter
=== CONT TestBox/box.Simple
=== CONT TestBox/box.AlignRight
=== CONT TestBox/box.AlignCenter
=== CONT TestBox/box.AlignLeft
=== CONT TestBox/box.Bold.Border
--- PASS: TestBox (0.00s)
--- PASS: TestBox/box.Simple (1.00s)
--- PASS: TestBox/box.AlignRight (1.00s)
--- PASS: TestBox/box.AlignLeft (1.00s)
--- PASS: TestBox/box.AlignCenter (1.00s)
--- PASS: TestBox/box.Bold.Border (1.00s)
PASS
coverage: 5.6% of statements
ok github.com/rivo/tview 2.006s
If you add some test and want to update screens , then run UPDATE=true go test and after that screens are updated.
Feel free for merge and reject.
I think I can get behind this :smile: .. you can see something similar in the wild currently here. Utilizing this along with testscript may make a lot of the code written easily testable. Interested to see what @rivo thinks..
Just for information, race is ok. Just run go test -race.