wire: use return in tests instead of panic (google/go-cloud#169)
Fixes google/go-cloud#105
This commit is contained in:
3
internal/wire/testdata/Chain/foo/wire.go
vendored
3
internal/wire/testdata/Chain/foo/wire.go
vendored
@@ -21,5 +21,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectFooBar() FooBar {
|
func injectFooBar() FooBar {
|
||||||
panic(wire.Build(Set))
|
wire.Build(Set)
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
3
internal/wire/testdata/Cleanup/foo/wire.go
vendored
3
internal/wire/testdata/Cleanup/foo/wire.go
vendored
@@ -21,5 +21,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectBar() (*Bar, func()) {
|
func injectBar() (*Bar, func()) {
|
||||||
panic(wire.Build(provideFoo, provideBar))
|
wire.Build(provideFoo, provideBar)
|
||||||
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,5 +35,6 @@ func provideMessage() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func injectedMessage() string {
|
func injectedMessage() string {
|
||||||
panic(wire.Build(provideMessage))
|
wire.Build(provideMessage)
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
|
|||||||
3
internal/wire/testdata/Cycle/foo/wire.go
vendored
3
internal/wire/testdata/Cycle/foo/wire.go
vendored
@@ -21,5 +21,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectedBaz() Baz {
|
func injectedBaz() Baz {
|
||||||
panic(wire.Build(provideFoo, provideBar, provideBaz))
|
wire.Build(provideFoo, provideBar, provideBaz)
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
3
internal/wire/testdata/EmptyVar/foo/wire.go
vendored
3
internal/wire/testdata/EmptyVar/foo/wire.go
vendored
@@ -21,5 +21,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectedMessage() string {
|
func injectedMessage() string {
|
||||||
panic(wire.Build(myFakeSet))
|
wire.Build(myFakeSet)
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,5 +22,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectedMessage() string {
|
func injectedMessage() string {
|
||||||
panic(wire.Build(bar.Value))
|
wire.Build(bar.Value)
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,5 +24,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectedFile() *os.File {
|
func injectedFile() *os.File {
|
||||||
panic(wire.Build(bar.Value))
|
wire.Build(bar.Value)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,10 +17,11 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/google/go-cloud/wire"
|
|
||||||
"foo"
|
"foo"
|
||||||
|
"github.com/google/go-cloud/wire"
|
||||||
)
|
)
|
||||||
|
|
||||||
func injectFooer() foo.Fooer {
|
func injectFooer() foo.Fooer {
|
||||||
panic(wire.Build(Set))
|
wire.Build(Set)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,5 +21,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectFooBar(foo Foo) FooBar {
|
func injectFooBar(foo Foo) FooBar {
|
||||||
panic(wire.Build(Set))
|
wire.Build(Set)
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,5 +21,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectBar(foo Foo) Bar {
|
func injectBar(foo Foo) Bar {
|
||||||
panic(wire.Build(Set))
|
wire.Build(Set)
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,5 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectedMessage() string {
|
func injectedMessage() string {
|
||||||
wire.Build(provideMessage)
|
panic(wire.Build(provideMessage))
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
@@ -21,5 +21,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectFooer() Fooer {
|
func injectFooer() Fooer {
|
||||||
panic(wire.Build(Set))
|
wire.Build(Set)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectFooBar() FooBar {
|
func injectFooBar() FooBar {
|
||||||
panic(wire.Build(
|
wire.Build(
|
||||||
provideBar,
|
provideBar,
|
||||||
provideFooBar,
|
provideFooBar,
|
||||||
wire.Bind((*Fooer)(nil), (*Bar)(nil))))
|
wire.Bind((*Fooer)(nil), (*Bar)(nil)),
|
||||||
|
)
|
||||||
|
return FooBar{}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,5 +21,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectedMessage() string {
|
func injectedMessage() string {
|
||||||
panic(wire.Build(provideMessage))
|
wire.Build(provideMessage)
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,5 +21,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectedMessage() string {
|
func injectedMessage() string {
|
||||||
panic(wire.Build(wire.Value("Hello, World!")))
|
wire.Build(wire.Value("Hello, World!"))
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,5 +21,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectFooer() Fooer {
|
func injectFooer() Fooer {
|
||||||
panic(wire.Build(provideBar))
|
wire.Build(provideBar)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,5 +26,6 @@ import (
|
|||||||
// parameter names on the inject stub.
|
// parameter names on the inject stub.
|
||||||
|
|
||||||
func inject(stdcontext.Context, struct{}) (context, error) {
|
func inject(stdcontext.Context, struct{}) (context, error) {
|
||||||
panic(wire.Build(provide))
|
wire.Build(provide)
|
||||||
|
return context{}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,5 +21,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectBaz() (Baz, func(), error) {
|
func injectBaz() (Baz, func(), error) {
|
||||||
panic(wire.Build(provideFoo, provideBar, provideBaz))
|
wire.Build(provideFoo, provideBar, provideBaz)
|
||||||
|
return 0, nil, nil
|
||||||
}
|
}
|
||||||
|
|||||||
3
internal/wire/testdata/PkgImport/foo/wire.go
vendored
3
internal/wire/testdata/PkgImport/foo/wire.go
vendored
@@ -21,5 +21,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectFooBar() FooBar {
|
func injectFooBar() FooBar {
|
||||||
panic(wire.Build(Set))
|
wire.Build(Set)
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,5 +21,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectFoo() (Foo, error) {
|
func injectFoo() (Foo, error) {
|
||||||
panic(wire.Build(Set))
|
wire.Build(Set)
|
||||||
|
return 0, nil
|
||||||
}
|
}
|
||||||
|
|||||||
3
internal/wire/testdata/Struct/foo/wire.go
vendored
3
internal/wire/testdata/Struct/foo/wire.go
vendored
@@ -21,5 +21,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectFooBar() FooBar {
|
func injectFooBar() FooBar {
|
||||||
panic(wire.Build(Set))
|
wire.Build(Set)
|
||||||
|
return FooBar{}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,5 +21,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectFooBar() *FooBar {
|
func injectFooBar() *FooBar {
|
||||||
panic(wire.Build(Set))
|
wire.Build(Set)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
3
internal/wire/testdata/TwoDeps/foo/wire.go
vendored
3
internal/wire/testdata/TwoDeps/foo/wire.go
vendored
@@ -21,5 +21,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectFooBar() FooBar {
|
func injectFooBar() FooBar {
|
||||||
panic(wire.Build(Set))
|
wire.Build(Set)
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,5 +22,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectedMessage() string {
|
func injectedMessage() string {
|
||||||
panic(wire.Build(bar.Value))
|
wire.Build(bar.Value)
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,5 +21,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectFooBar() FooBar {
|
func injectFooBar() FooBar {
|
||||||
panic(wire.Build(Set))
|
wire.Build(Set)
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,5 +21,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectedMessage() Foo {
|
func injectedMessage() Foo {
|
||||||
panic(wire.Build(wire.Value(Foo("Hello, World!"))))
|
wire.Build(wire.Value(Foo("Hello, World!")))
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
|
|||||||
3
internal/wire/testdata/VarValue/foo/wire.go
vendored
3
internal/wire/testdata/VarValue/foo/wire.go
vendored
@@ -21,5 +21,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectedMessage() string {
|
func injectedMessage() string {
|
||||||
panic(wire.Build(wire.Value(msg)))
|
wire.Build(wire.Value(msg))
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
|
|||||||
3
internal/wire/testdata/Vendor/foo/wire.go
vendored
3
internal/wire/testdata/Vendor/foo/wire.go
vendored
@@ -22,5 +22,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func injectedMessage() string {
|
func injectedMessage() string {
|
||||||
panic(wire.Build(bar.ProvideMessage))
|
wire.Build(bar.ProvideMessage)
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user