cweill / gotests

Automatically generate Go test boilerplate from your source code.
Apache License 2.0
4.95k stars 345 forks source link

Verify test package name when generating tests #131

Open SteelPhase opened 4 years ago

SteelPhase commented 4 years ago

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).

cweill commented 3 years ago

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.

SteelPhase commented 3 years ago

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

cweill commented 3 years ago

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.

SteelPhase commented 3 years ago

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