petergtz / pegomock

Pegomock is a powerful, yet simple mocking framework for the Go programming language
Apache License 2.0
253 stars 28 forks source link

Master is broken with matchers and white box tests #77

Closed jpopadak closed 5 years ago

jpopadak commented 5 years ago

@petergtz Turns out this issue of master for the tooling vs v2.0.2 for the library is occurring again with your latest master changes (similar issue to #74 ):

pegomock: error: Could not determine package name.: Error while determining Go package name from Go file in /Users/james.popadak/go/src/github.com/<team>/<repo>/internal/app/module/resourcegrouptype/createresourcegrouptype: 
[/Users/james.popadak/go/src/github.com/<team>/<repo>/internal/app/module/resourcegrouptype/createresourcegrouptype/endpoint_test.go:16:2: could not import 
github.com/<team>/<repo>/internal/app/module/resourcegrouptype/createresourcegrouptype/matchers (cannot find package 
"github.com/<team>/<repo>/internal/app/module/resourcegrouptype/createresourcegrouptype/matchers" in any of:
<path>

We have two things occurring, but dont know if they are related.

(1) Turns out that if you delete the matchers and attempt to re-generate, it fails to find the matchers (which makes sense because they were deleted and havent been generated). And the most immediate issue for us (2) If you have a file named pagehelper but you are attempting to do a White Box test using the actual package name instead of package <packagename>_test, your parser fails.

/Users/james.popadak/go/src/github.com/<team>/<repo>/internal/app/module/resourcegrouptype/listresourcegrouptype/pagehelper_wb_test.go:1:1: package listresourcegrouptype; expected listresourcegrouptype_test
petergtz commented 5 years ago

Hi @jpopadak, this shouldn't be an issue with tooling versus latest release. I made sure these are in sync now. It looks like the package determination is using wrong assumptions from what I can see from your snippets.

Wondering: is this blocking you completely or can you somehow pin your stuff to the previous version. Depending on your answer I can either roll back part of the change (only deal correctly with dashes) or I could take more time, maybe a couple of days, to figure out what's actually wrong and fix it.

petergtz commented 5 years ago

Actually, I can see now what is wrong. I need to change the tests to take into account more complex dependency setups. Let me roll back that part of the code and release it as v2.0.3.

Sorry about this.

petergtz commented 5 years ago

@jpopadak You should be good to go with v2.0.3. Will be offline for a while. Please post back if there are still open issues.

petergtz commented 5 years ago

@jpopadak closing this assuming the issue is resolved for you. Please re-open if not.

jpopadak commented 5 years ago

Sorry for the late response, been a busy week. The rollback worked and things are working again.

It was a blocker for our development team as no tests on our CI server were passing due to tooling being new.