-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c5ff306
commit 4ced14b
Showing
65 changed files
with
253 additions
and
72 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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 was deleted.
Oops, something went wrong.
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,7 @@ | ||
package type_alias | ||
|
||
type Type = int | ||
|
||
type Interface1 interface { | ||
Foo() Type | ||
} |
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,56 @@ | ||
package type_alias_test | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
"github.com/vektra/mockery/v2/pkg" | ||
"golang.org/x/tools/go/packages" | ||
) | ||
|
||
func TestTypeAliasResolved(t *testing.T) { | ||
parser := pkg.NewParser([]string{}) | ||
require.NoError(t, parser.ParsePackages(context.Background(), []string{"github.com/vektra/mockery/v2/fixtures/type_alias"})) | ||
var config packages.Config | ||
config.Mode = packages.NeedTypes | | ||
packages.NeedTypesSizes | | ||
packages.NeedSyntax | | ||
packages.NeedTypesInfo | | ||
packages.NeedImports | | ||
packages.NeedName | | ||
packages.NeedFiles | | ||
packages.NeedCompiledGoFiles | ||
config.Tests = true | ||
packageList, err := packages.Load(&config, "github.com/vektra/mockery/v2/pkg/fixtures/type_alias") | ||
require.NoError(t, err) | ||
require.Equal(t, 3, len(packageList)) | ||
|
||
//var pkg *packages.Package | ||
|
||
for _, pkgElem := range packageList { | ||
t.Log(pkgElem.ID) | ||
} | ||
|
||
//pkg := packageList[0] | ||
//for _, file := range pkg.Syntax { | ||
// t.Log("FOUND FILE") | ||
// t.Log(file.Name.Name) | ||
// for _, decl := range file.Decls { | ||
// t.Logf("%v", decl) | ||
// } | ||
//} | ||
t.Fail() | ||
|
||
} | ||
|
||
//func TestTypeAliasUnResolved(t *testing.T) { | ||
// expectedReturn := Type(1) | ||
// mockInterface := NewInterfaceWithUnresolvedAlias(t) | ||
// mockInterface.EXPECT().Foo().Return(expectedReturn) | ||
// | ||
// actualReturn := mockInterface.Foo() | ||
// assert.Equal(t, "foo", reflect.TypeOf(actualReturn).String()) | ||
// assert.Equal(t, expectedReturn, actualReturn) | ||
// | ||
//} |
77 changes: 77 additions & 0 deletions
77
pkg/fixtures/type_alias/mock_InterfaceWithResolvedAlias_test.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
80 changes: 80 additions & 0 deletions
80
pkg/fixtures/type_alias/mock_InterfaceWithUnresolvedAlias_test.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.