I have a test file called db/db_test.go
and I want to import a NewMock()
function from db/google_test/mock.go
(mock.go
has package name google_test
). That works.
If I rename db/google_test/mock.go
to db/google/mock_test.go
, even if its package name is google_test
, then when I compile db_test.go
, it cannot find NewMock()
(cannot find package ".../db/google_test"
), even though I have an import .../db/google_test
in db_test.go
.
Is there any way to place my mocker into the package db/google
with a package name of google_test
and have it be found by the db_test.go
code?
Can test sub-packages be imported in test packages higher up the directory tree?
Aucun commentaire:
Enregistrer un commentaire