Let’s talk about simple tests using Go with testing package.
Let’s get a file
simplemath.go by my gist:
With this file basic, go to our test.
Create test folder, and simplemath_test.go in this folder.
We will need of testing package.
1 2 3
And import the
1 2 3 4
Remember of put in this file the first line the code:
Let’s test the
Under the import of packets add the func.
1 2 3 4 5 6 7 8
Running the test:
Running the verbose format:
1 2 3 4 5 6
News tests with Multiply() and Subtract()
simplemath_test.go file completed this down with the other test functions
Thanks guys! To the next post!