-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
12 changed files
with
194 additions
and
41 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,32 @@ | ||
package fakes | ||
|
||
import ( | ||
"sync" | ||
|
||
"github.com/ryanmoran/faux/acceptance/fixtures" | ||
) | ||
|
||
type GenericInterface[T comparable, S comparable] struct { | ||
SomeMethodCall struct { | ||
mutex sync.Mutex | ||
CallCount int | ||
Receives struct { | ||
MapTS map[T]S | ||
} | ||
Returns struct { | ||
ResultIntError fixtures.Result[int, error] | ||
} | ||
Stub func(map[T]S) fixtures.Result[int, error] | ||
} | ||
} | ||
|
||
func (f *GenericInterface[T, S]) SomeMethod(param1 map[T]S) fixtures.Result[int, error] { | ||
f.SomeMethodCall.mutex.Lock() | ||
defer f.SomeMethodCall.mutex.Unlock() | ||
f.SomeMethodCall.CallCount++ | ||
f.SomeMethodCall.Receives.MapTS = param1 | ||
if f.SomeMethodCall.Stub != nil { | ||
return f.SomeMethodCall.Stub(param1) | ||
} | ||
return f.SomeMethodCall.Returns.ResultIntError | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
package parsing | ||
|
||
import "go/types" | ||
import ( | ||
"go/types" | ||
) | ||
|
||
type Signature struct { | ||
Name 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,8 @@ | ||
package parsing | ||
|
||
import "go/types" | ||
|
||
type TypeParam struct { | ||
Name string | ||
Constraint types.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
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.