Closed carloschida closed 2 years ago
@carloschida go test -v .
should help you. See below:
➜ btcutil git:(master) ✗ go test . -v
=== RUN TestAddresses
--- PASS: TestAddresses (0.02s)
=== RUN TestAmountCreation
--- PASS: TestAmountCreation (0.00s)
=== RUN TestAmountUnitConversions
--- PASS: TestAmountUnitConversions (0.00s)
=== RUN TestAmountMulF64
--- PASS: TestAmountMulF64 (0.00s)
=== RUN TestAppDataDir
--- PASS: TestAppDataDir (0.00s)
appdata_test.go:123: Running 54 tests
=== RUN TestBlock
--- PASS: TestBlock (0.00s)
=== RUN TestNewBlockFromBytes
--- PASS: TestNewBlockFromBytes (0.00s)
=== RUN TestNewBlockFromBlockAndBytes
--- PASS: TestNewBlockFromBlockAndBytes (0.00s)
=== RUN TestBlockErrors
--- PASS: TestBlockErrors (0.00s)
=== RUN TestNewTLSCertPair
--- PASS: TestNewTLSCertPair (0.02s)
=== RUN TestTx
--- PASS: TestTx (0.00s)
=== RUN TestNewTxFromBytes
--- PASS: TestNewTxFromBytes (0.00s)
=== RUN TestTxErrors
--- PASS: TestTxErrors (0.00s)
=== RUN TestEncodeDecodeWIF
--- PASS: TestEncodeDecodeWIF (0.00s)
=== RUN ExampleAmount
--- PASS: ExampleAmount (0.00s)
=== RUN ExampleNewAmount
--- PASS: ExampleNewAmount (0.00s)
=== RUN ExampleAmount_unitConversions
--- PASS: ExampleAmount_unitConversions (0.00s)
PASS
ok github.com/btcsuite/btcutil 0.475s
I'm relatively new to go and don't know much about standards and practices, I just needed assistance/support with the following behaviour.
I tried to test the package with
go test
,gocov
and the providedcov_report.sh
but all of them show the same errors:./address_test.go:56:12: undefined: btcutil.TstAddressPubKeyHash ./address_test.go:74:12: undefined: btcutil.TstAddressPubKeyHash ...
Upon inspection I see that the tests are in
package btcutil_test
whereas the code is inpackage btcutil
. A detailed explanation for this decision is dicussed in #7.Returning to the undefined function – it turns out that the function(s) invoked by
btcutil_test
are indeed declared inbtcutil
'sinternal_test.go
. Nevertheless, my IDE reports that theTst...
functions are not being used, leading to the compiler not including them (right?).My goal is to test, and help improve the code coverage. How can I proceed to have the tests running and passing?
About my setup: go version go1.13 darwin/amd64 GoLand 2019.2.2