Skip to content

Box: add tests#441

Open
Konstantin8105 wants to merge 2 commits intorivo:masterfrom
Konstantin8105:master
Open

Box: add tests#441
Konstantin8105 wants to merge 2 commits intorivo:masterfrom
Konstantin8105:master

Conversation

@Konstantin8105
Copy link
Copy Markdown

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.

@jbpratt
Copy link
Copy Markdown

jbpratt commented May 3, 2020

I think I can get behind this 😄 .. 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..

@Konstantin8105
Copy link
Copy Markdown
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants