summaryrefslogtreecommitdiff
path: root/sdk/sdk_test.go
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2020-05-07 16:17:42 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2020-05-07 16:17:42 +0000
commitbd7e3295dd9a2fe372b6b78dfdac8382ce24ae1a (patch)
tree2f44d479ebed4200ec6d745f9b649015d890e0b7 /sdk/sdk_test.go
parent38e2fbdc902b267ddfb0aa8ded4d91cd13fdd170 (diff)
parent4b8b79394fa5eeddc532aa9e38870dd1c3a291b5 (diff)
Merge "Allow extractCommonProperties to return an error"
Diffstat (limited to 'sdk/sdk_test.go')
-rw-r--r--sdk/sdk_test.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/sdk/sdk_test.go b/sdk/sdk_test.go
index 7ae3a03b9..095f83607 100644
--- a/sdk/sdk_test.go
+++ b/sdk/sdk_test.go
@@ -231,6 +231,7 @@ type EmbeddedPropertiesStruct struct {
}
type testPropertiesStruct struct {
+ name string
private string
Public_Kept string `sdk:"keep"`
S_Common string
@@ -246,10 +247,17 @@ func (p *testPropertiesStruct) optimizableProperties() interface{} {
return p
}
+func (p *testPropertiesStruct) String() string {
+ return p.name
+}
+
+var _ propertiesContainer = (*testPropertiesStruct)(nil)
+
func TestCommonValueOptimization(t *testing.T) {
- common := &testPropertiesStruct{}
+ common := &testPropertiesStruct{name: "common"}
structs := []propertiesContainer{
&testPropertiesStruct{
+ name: "struct-0",
private: "common",
Public_Kept: "common",
S_Common: "common",
@@ -264,6 +272,7 @@ func TestCommonValueOptimization(t *testing.T) {
},
},
&testPropertiesStruct{
+ name: "struct-1",
private: "common",
Public_Kept: "common",
S_Common: "common",
@@ -285,6 +294,7 @@ func TestCommonValueOptimization(t *testing.T) {
h := TestHelper{t}
h.AssertDeepEquals("common properties not correct",
&testPropertiesStruct{
+ name: "common",
private: "",
Public_Kept: "",
S_Common: "common",
@@ -302,6 +312,7 @@ func TestCommonValueOptimization(t *testing.T) {
h.AssertDeepEquals("updated properties[0] not correct",
&testPropertiesStruct{
+ name: "struct-0",
private: "common",
Public_Kept: "common",
S_Common: "",
@@ -319,6 +330,7 @@ func TestCommonValueOptimization(t *testing.T) {
h.AssertDeepEquals("updated properties[1] not correct",
&testPropertiesStruct{
+ name: "struct-1",
private: "common",
Public_Kept: "common",
S_Common: "",