goose: read tests from testdata
Since tests are all written in terms of Go source, it makes tests easier to write. They still need to be arranged in a GOPATH for go build, but tests that just call Generate can operate in-place because I've faked the filesystem. Reviewed-by: Tuo Shan <shantuo@google.com> Reviewed-by: Herbie Ong <herbie@google.com>
This commit is contained in:
23
internal/goose/testdata/InjectInputConflict/foo/foo.go
vendored
Normal file
23
internal/goose/testdata/InjectInputConflict/foo/foo.go
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
// I'm on the fence as to whether this should be an error (versus an
|
||||
// override). For now, I will make it an error that can be relaxed
|
||||
// later.
|
||||
fmt.Println(injectBar(40))
|
||||
}
|
||||
|
||||
type Foo int
|
||||
type Bar int
|
||||
|
||||
//goose:provide Set
|
||||
func provideFoo() Foo {
|
||||
return -888
|
||||
}
|
||||
|
||||
//goose:provide Set
|
||||
func provideBar(foo Foo) Bar {
|
||||
return 2
|
||||
}
|
||||
7
internal/goose/testdata/InjectInputConflict/foo/foo_goose.go
vendored
Normal file
7
internal/goose/testdata/InjectInputConflict/foo/foo_goose.go
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
//+build gooseinject
|
||||
|
||||
package main
|
||||
|
||||
//goose:use Set
|
||||
|
||||
func injectBar(foo Foo) Bar
|
||||
1
internal/goose/testdata/InjectInputConflict/out.txt
vendored
Normal file
1
internal/goose/testdata/InjectInputConflict/out.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
ERROR
|
||||
1
internal/goose/testdata/InjectInputConflict/pkg
vendored
Normal file
1
internal/goose/testdata/InjectInputConflict/pkg
vendored
Normal file
@@ -0,0 +1 @@
|
||||
foo
|
||||
Reference in New Issue
Block a user