Skip to content
This repository was archived by the owner on Mar 3, 2022. It is now read-only.

Commit 0a788db

Browse files
author
Zack Field
committed
Add test for storing variable of struct type
1 parent eb8912b commit 0a788db

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

store_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,26 @@ func TestStoreNested(t *testing.T) {
9797
dest, src)
9898
}
9999
}
100+
101+
type testStruct1 struct {
102+
V0 uint32
103+
V1 bool
104+
}
105+
106+
func TestStoreVariantStruct(t *testing.T) {
107+
src := MakeVariantWithSignature([]interface{}{1, true}, Signature{"(ub)"})
108+
dest := testStruct1{}
109+
err := Store([]interface{}{src}, &dest)
110+
if err != nil {
111+
t.Fatal(err)
112+
}
113+
if !reflect.DeepEqual(dest.V0, uint32(1)) {
114+
t.Errorf("not equal: got '%v', want '%v'",
115+
dest.V0, 1)
116+
}
117+
if !reflect.DeepEqual(dest.V1, true) {
118+
t.Errorf("not equal: got '%v', want '%v'",
119+
dest.V1, true)
120+
}
121+
122+
}

0 commit comments

Comments
 (0)