stellar / go

Stellar's public monorepo of go code
https://stellar.org/developers
Apache License 2.0
1.3k stars 499 forks source link

Consolidate test helper functions #842

Open howardtw opened 5 years ago

howardtw commented 5 years ago

https://github.com/stellar/go/blob/master/services/horizon/internal/helpers_test.go https://github.com/stellar/go/blob/master/services/horizon/internal/httpt_test.go https://github.com/stellar/go/blob/master/services/horizon/internal/assertions_test.go

howardtw commented 5 years ago

It's not that we cannot put non-test functions in *_test.go. It's totally fine to put test helper function in *_test.go. However, if we want to define a struct like this

type HTTPT struct {
    Assert *Assertions
    App    *App
    RH     test.RequestHelper
    *test.T
}

and create a bunch of methods on top, then it makes more sense to put it at a httptest package, so actions package can also use it for example.