mirror of
https://github.com/golang/go
synced 2024-11-18 22:04:43 -07:00
go/packages/packagestest: add Exported as a type expectations can use
This is mostly to allow access to exported file contents for tests that need the source. Change-Id: I0ef946d7bdd971b931e509d2cb54e2c59649fe47 Reviewed-on: https://go-review.googlesource.com/c/tools/+/166883 Reviewed-by: Michael Matloob <matloob@golang.org> Run-TryBot: Ian Cottrell <iancottrell@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
e65039ee41
commit
516ab0aa77
@ -180,6 +180,7 @@ var (
|
||||
rangeType = reflect.TypeOf(Range{})
|
||||
fsetType = reflect.TypeOf((*token.FileSet)(nil))
|
||||
regexType = reflect.TypeOf((*regexp.Regexp)(nil))
|
||||
exportedType = reflect.TypeOf((*Exported)(nil))
|
||||
)
|
||||
|
||||
// converter converts from a marker's argument parsed from the comment to
|
||||
@ -210,6 +211,10 @@ func (e *Exported) buildConverter(pt reflect.Type) (converter, error) {
|
||||
return func(n *expect.Note, args []interface{}) (reflect.Value, []interface{}, error) {
|
||||
return reflect.ValueOf(e.fset), args, nil
|
||||
}, nil
|
||||
case pt == exportedType:
|
||||
return func(n *expect.Note, args []interface{}) (reflect.Value, []interface{}, error) {
|
||||
return reflect.ValueOf(e), args, nil
|
||||
}, nil
|
||||
case pt == posType:
|
||||
return func(n *expect.Note, args []interface{}) (reflect.Value, []interface{}, error) {
|
||||
r, remains, err := e.rangeConverter(n, args)
|
||||
|
Loading…
Reference in New Issue
Block a user