mirror of
https://github.com/golang/go.git
synced 2025-05-21 07:13:27 +00:00
Use the packagestest framework to test completion. Add support for a slice of token.Position to packagestest to support this. Change-Id: Ie5ddece4446a3c74419727461a77faa3788cb040 Reviewed-on: https://go-review.googlesource.com/c/148197 Reviewed-by: Ian Cottrell <iancottrell@google.com> Run-TryBot: Rebecca Stambler <rstambler@golang.org>
24 lines
683 B
Go
24 lines
683 B
Go
package foo
|
|
|
|
type StructFoo struct { //@mark(StructFoo, "StructFoo"),item(StructFoo, "StructFoo", "struct{...}", "struct")
|
|
Value int //@mark(Value, "Value"),item(Value, "Value", "int", "field")
|
|
}
|
|
|
|
// TODO(rstambler): Create pre-set builtins?
|
|
//@mark(Error, ""),item(Error, "Error()", "string", "method")
|
|
|
|
func Foo() { //@mark(Foo, "Foo"),item(Foo, "Foo()", "", "func")
|
|
var err error
|
|
err.Error() //@complete("E", Error)
|
|
}
|
|
|
|
func _() {
|
|
var sFoo StructFoo //@complete("t", StructFoo)
|
|
if x := sFoo; x.Value == 1 { //@complete("V", Value)
|
|
return
|
|
}
|
|
}
|
|
|
|
//@complete("", Foo, IntFoo, StructFoo)
|
|
type IntFoo int //@mark(IntFoo, "IntFoo"),item(IntFoo, "IntFoo", "int", "type")
|