Support extracting common values from embedded structures

This change also added support for excluding properties from common
value extraction by using a struct tag of `sdk:"keep"` That was needed
to prevent the fields in SdkMemberPropertiesBase from having their
values cleared.

The purpose of this change is to make it easier to share functionality
across sdk member types.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: Ie5160a8f854056920e411801ca20721eab7c8578
Change-Id: Ie5160a8f854056920e411801ca20721eab7c8578
This commit is contained in:
Paul Duffin
2020-03-10 22:17:04 +00:00
parent 89937326ab
commit 49096815fe
4 changed files with 141 additions and 10 deletions

View File

@@ -19,6 +19,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"reflect"
"strings"
"testing"
@@ -176,6 +177,13 @@ func (h *TestHelper) AssertTrimmedStringEquals(message string, expected string,
h.AssertStringEquals(message, strings.TrimSpace(expected), strings.TrimSpace(actual))
}
func (h *TestHelper) AssertDeepEquals(message string, expected interface{}, actual interface{}) {
h.t.Helper()
if !reflect.DeepEqual(actual, expected) {
h.t.Errorf("%s: expected %#v, actual %#v", message, expected, actual)
}
}
// Encapsulates result of processing an SDK definition. Provides support for
// checking the state of the build structures.
type testSdkResult struct {