youtuber-description-links icon indicating copy to clipboard operation
youtuber-description-links copied to clipboard

Putting tests next to what will be tested

Open SunkPlane29 opened this issue 4 years ago • 0 comments

Currently, the tests written for this project are in a separate tests folder. It's best practice in Go putting each test inside the package that defines what is to be tested. For example:

service/
    youtube.go
    youtube_test.go
    extract_links.go
    extract_links_test.go

Note that there are some cases where tests can be put in a separate folder, but it's pretty uncommon.

We can use some open source projects for guidance: https://github.com/kubernetes/kubernetes/tree/master/pkg/controlplane https://github.com/tsuru/tsuru/tree/master/api https://github.com/cockroachdb/cockroach/tree/master/pkg/base https://github.com/golang/go/tree/master/src/bytes (Go's standard bytes package)

SunkPlane29 avatar Oct 01 '20 16:10 SunkPlane29