diff options
author | 2021-03-16 19:30:32 +0000 | |
---|---|---|
committer | 2021-03-17 16:18:17 +0000 | |
commit | 3d11961d43073f7ee5a2aac60cab20aa3ffbe9a2 (patch) | |
tree | 376255b9de2fcfdd1db6640310cfde691f3280db /android/test_asserts.go | |
parent | 140a8e183d0a551683cffe9c74094ac50948cd6c (diff) |
Add AssertSame
Bug: 182885307
Test: m nothing
Change-Id: I9af030ae9cd3fcfd3442af82c5fcba60aec80861
Diffstat (limited to 'android/test_asserts.go')
-rw-r--r-- | android/test_asserts.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/android/test_asserts.go b/android/test_asserts.go index 5100abb79..977e1af9f 100644 --- a/android/test_asserts.go +++ b/android/test_asserts.go @@ -22,6 +22,15 @@ import ( // This file contains general purpose test assert functions. +// AssertSame checks if the expected and actual values are equal and if they are not then +// it reports an error prefixed with the supplied message and including a reason for why it failed. +func AssertSame(t *testing.T, message string, expected interface{}, actual interface{}) { + t.Helper() + if actual != expected { + t.Errorf("%s: expected:\n%#v\nactual:\n%#v", message, expected, actual) + } +} + // AssertBoolEquals checks if the expected and actual values are equal and if they are not then it // reports an error prefixed with the supplied message and including a reason for why it failed. func AssertBoolEquals(t *testing.T, message string, expected bool, actual bool) { |