mirror of
https://github.com/netbirdio/gomobile-tvos-fork.git
synced 2026-05-22 18:43:29 -07:00
bind: support reference types as struct fields.
Reference types here mean pointers to struct types and exported interface types. Previously, gobind generated invalid go/java sources. Change-Id: Icd666ebbb8edb70c613311798d602fd88cb4479c Reviewed-on: https://go-review.googlesource.com/9997 Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
committed by
Hyang-Ah Hana Kim
parent
536b3a3197
commit
b658bfdf39
@@ -246,8 +246,15 @@ public class SeqTest extends AndroidTestCase {
|
||||
|
||||
public void testUnnamedParams() {
|
||||
final String msg = "1234567";
|
||||
assertEquals("Want the length of \"1234567\" passed after unnamed params",
|
||||
assertEquals("want the length of \"1234567\" passed after unnamed params",
|
||||
7, Testpkg.UnnamedParams(10, 20, msg));
|
||||
}
|
||||
|
||||
public void testPointerToStructAsField() {
|
||||
Testpkg.Node a = Testpkg.NewNode("A");
|
||||
Testpkg.Node b = Testpkg.NewNode("B");
|
||||
a.setNext(b);
|
||||
String got = a.String();
|
||||
assertEquals("want Node A points to Node B", "A:B:<end>", got);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,3 +124,19 @@ func AppendToString(str string, someBytes []byte) []byte {
|
||||
func UnnamedParams(_, _ int, p0 string) int {
|
||||
return len(p0)
|
||||
}
|
||||
|
||||
type Node struct {
|
||||
V string
|
||||
Next *Node
|
||||
}
|
||||
|
||||
func NewNode(name string) *Node {
|
||||
return &Node{V: name}
|
||||
}
|
||||
|
||||
func (a *Node) String() string {
|
||||
if a == nil {
|
||||
return "<end>"
|
||||
}
|
||||
return a.V + ":" + a.Next.String()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user