jeudi 15 avril 2021

Share data across different package's tests files

I have the following architecture :

- package-a
   - a.go
   - a_test.go
- package-b
   - b.go
   - b_test.go
- package-c
   - c.go
   - c_test.go

I would like to use data initialized in a_test.go inside of b_test.go, is it possible ?

Example :

var FakeData = FakeData{ something... }

I have made my own researches and it look like it is not possible to share data across different package's tests files.

enter image description here

How to share test interfaces between Go packages?

enter image description here

https://github.com/golang/go/issues/10184


First : is my assumption correct ?

Second : do you know of any documentation that would enforce the fact ?


I have looked at https://golang.org/ref/spec but could not find anything.

Thanks

Aucun commentaire:

Enregistrer un commentaire