summaryrefslogtreecommitdiff
path: root/android/test_asserts.go
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2021-03-18 08:56:21 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2021-03-18 08:56:21 +0000
commitc14e8aa6a8827a38acbfa96ae6ad04783f00919e (patch)
treee1d770c6612c550487d6d2c54248c0803d36e0bf /android/test_asserts.go
parent28f0e9e2cba7f287f3a39c11d018faf16a503439 (diff)
parent3d11961d43073f7ee5a2aac60cab20aa3ffbe9a2 (diff)
Merge "Add AssertSame"
Diffstat (limited to 'android/test_asserts.go')
-rw-r--r--android/test_asserts.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/android/test_asserts.go b/android/test_asserts.go
index e2df12fa9..4b5e9343e 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) {