diff options
author | 2023-06-01 14:42:59 -0700 | |
---|---|---|
committer | 2023-06-09 06:16:06 -0700 | |
commit | 175073c472baadcf6ccd7bf94f013a28edf0713a (patch) | |
tree | 445ad40f4b620cdb0ab83ef38aff29b1d0b3f0eb /android/test_asserts.go | |
parent | f1d37b351147ba74be40f5f313e61e9956e44d7f (diff) |
Make aconfig flags generate a library instead of a srcjar.
Also add unit tests for the rest of device_config
Bug: 283475679
Test: m nothing (soong unit tests)
Change-Id: Iee18a1f2f2cbb23e8c8d84c54e903b32be29a693
Diffstat (limited to 'android/test_asserts.go')
-rw-r--r-- | android/test_asserts.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/android/test_asserts.go b/android/test_asserts.go index 5cc7e4ac0..3a2cb1ad9 100644 --- a/android/test_asserts.go +++ b/android/test_asserts.go @@ -200,6 +200,22 @@ func AssertArrayString(t *testing.T, message string, expected, actual []string) } } +// Asserts that each of the Paths in actual end with the corresponding string +// from expected. Useful to test that output paths contain expected items without +// hard-coding where intermediate files might be located. +func AssertPathsEndWith(t *testing.T, message string, expected []string, actual []Path) { + t.Helper() + if len(expected) != len(actual) { + t.Errorf("%s (length): expected %d, actual %d", message, len(expected), len(actual)) + return + } + for i := range expected { + if !strings.HasSuffix(actual[i].String(), expected[i]) { + t.Errorf("%s (item %d): expected '%s', actual '%s'", message, i, expected[i], actual[i].String()) + } + } +} + // AssertDeepEquals checks if the expected and actual values are equal using reflect.DeepEqual and // if they are not then it reports an error prefixed with the supplied message and including a // reason for why it failed. |