akito0107 / dicon Goto Github PK
View Code? Open in Web Editor NEW[DEPRECATED] this repository has been moved to: https://github.com/recruit-tech/dicon
License: Apache License 2.0
[DEPRECATED] this repository has been moved to: https://github.com/recruit-tech/dicon
License: Apache License 2.0
There are no api documentation...
Needs api documents.
In parser, FromExprToParameterType
func is untested.
Implements the test and improve testing coverage.
circular dependency can find at only runtime for now.
i want to detect to circular dependency at generate time.
add error to constructor return values.
now:
func NewDependency() Dependency {
return &dependency{}
}
expected:
func NewDependency() (Dependency, error) {
return &dependency{}, nil
}
generating mock code can't compile when mock method return values is empty.
go version go1.9.2 darwin/amd64
dicon revision: 81c5355
go get -u github.com/akito0107/dicon
cd $GOPATH/src/github.com/akito0107/dicon
git checkout 81c5355d6f1591b8cc4ed81deba7a58e4a2b4051
go build
test/container.go
package test
// +DICON
type Container interface {
A() (A, error)
}
test/a.go
package test
type A interface {
F()
}
type a struct{}
func (a *a) F() {}
func NewA() (A, error) {
return &a{}, nil
}
./dicon generate-mock --pkg test
mock/dicon_mock.go
// Code generated by "dicon"; DO NOT EDIT.
package mock
type AMock struct {
FMock func()
}
func NewAMock() *AMock {
return &AMock{}
}
func (mk *AMock) F() {
mk.FMock()
}
mock/dicon_mock.go
// Code generated by "dicon"; DO NOT EDIT.
package mock
type AMock struct {
FMock func()
}
func NewAMock() *AMock {
return &AMock{}
}
func (mk *AMock) F() {
return mk.FMock()
}
generating mock method arguments is incorrect.
go version go1.9.2 darwin/amd64
dicon revision: 81c5355
go get -u github.com/akito0107/dicon
cd $GOPATH/src/github.com/akito0107/dicon
git checkout 81c5355d6f1591b8cc4ed81deba7a58e4a2b4051
go build
test/container.go
package test
// +DICON
type Container interface {
A() (A, error)
}
test/a.go
package test
type A interface {
F(b, c int) int
}
type a struct{}
func (a *a) F(b, c int) int {
return 0
}
func NewA() (A, error) {
return &a{}, nil
}
./dicon generate-mock --pkg test
mock/dicon_mock.go
// Code generated by "dicon"; DO NOT EDIT.
package mock
type AMock struct {
FMock func(a0, a1 int) int
}
func NewAMock() *AMock {
return &AMock{}
}
func (mk *AMock) F(a0, a1 int) int {
return mk.FMock(a0, a1)
}
mock/dicon_mock.go
// Code generated by "dicon"; DO NOT EDIT.
package mock
type AMock struct {
FMock func(a0 int) int
}
func NewAMock() *AMock {
return &AMock{}
}
func (mk *AMock) F(a0 int) int {
return mk.FMock(a0)
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.