tview icon indicating copy to clipboard operation
tview copied to clipboard

Box: add tests

Open Konstantin8105 opened this issue 5 years ago • 2 comments

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.

Konstantin8105 avatar May 02 '20 22:05 Konstantin8105

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..

jbpratt avatar May 03 '20 01:05 jbpratt

Just for information, race is ok. Just run go test -race.

Konstantin8105 avatar May 03 '20 14:05 Konstantin8105