-
Notifications
You must be signed in to change notification settings - Fork 415
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- take type in account when using import replace types
- check more specific replace types first
- Loading branch information
1 parent
f54eea9
commit ee33b3d
Showing
7 changed files
with
91 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## Fix replace-type for different packages from the same source | ||
|
||
[Issue 710](https://github.com/vektra/mockery/pull/710) | ||
|
||
This package is used to test the case where multiple types come from the same package (`replace_type/rti/internal`), | ||
but results in types in different packages (`replace_type/rt1` and `replace_type/rt2`). | ||
|
||
Tests `TestReplaceTypePackageMultiplePrologue` and `TestReplaceTypePackageMultiple` use it to check if this outputs | ||
the correct import and type names. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package replace_type | ||
|
||
import ( | ||
"github.com/vektra/mockery/v2/pkg/fixtures/example_project/replace_type/rti/rt1" | ||
"github.com/vektra/mockery/v2/pkg/fixtures/example_project/replace_type/rti/rt2" | ||
) | ||
|
||
type RType interface { | ||
Replace1(f rt1.RType1) | ||
Replace2(f rt2.RType2) | ||
} |
9 changes: 9 additions & 0 deletions
9
pkg/fixtures/example_project/replace_type/rti/internal/rti.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package internal | ||
|
||
type RTInternal1 struct { | ||
A int | ||
} | ||
|
||
type RTInternal2 struct { | ||
B string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package rt1 | ||
|
||
import "github.com/vektra/mockery/v2/pkg/fixtures/example_project/replace_type/rti/internal" | ||
|
||
type RType1 = internal.RTInternal1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package rt2 | ||
|
||
import "github.com/vektra/mockery/v2/pkg/fixtures/example_project/replace_type/rti/internal" | ||
|
||
type RType2 = internal.RTInternal2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters