gotests icon indicating copy to clipboard operation
gotests copied to clipboard

Verify test package name when generating tests

Open SteelPhase opened this issue 5 years ago • 4 comments

I've noticed that when generating tests, they will generate as invalid if the *_test.go file uses the _test suffix in its package name (i.e.package *_test).

SteelPhase avatar May 15 '20 19:05 SteelPhase

I believe the convention is to save the *_test suffix for tests only, so this is working as intended, unless you have a concrete example of when this functionality is needed.

cweill avatar Dec 26 '20 23:12 cweill

I've heard it to referred to as external testing, but this page covers the functionality. I'm sure there's more info available

Test files that declare a package with the suffix "_test" will be compiled as a separate package, and then linked and run with the main test binary.

There is an issue on functionality documentation here

SteelPhase avatar Dec 26 '20 23:12 SteelPhase

I see, this is used for test-only packages right? If you want to send a PR to fix this, I'll be happy to approve.

cweill avatar Feb 22 '21 02:02 cweill

Yes it is, I'll see if I can come up with a simple way to solve this.

SteelPhase avatar Mar 07 '21 21:03 SteelPhase