Fix String8::operator+
The LHS was ignored when using:
String8 + String8
String8 + (const char*)
Add unit tests for above.
Bug: 2898473
Change-Id: Ic8fe7be668b665c36aaaa3fc3c3ffdfff0fbba25
diff --git a/include/utils/String8.h b/include/utils/String8.h
index 0b18fe3..4e41410 100644
--- a/include/utils/String8.h
+++ b/include/utils/String8.h
@@ -374,7 +374,7 @@
inline String8 String8::operator+(const String8& other) const
{
- String8 tmp;
+ String8 tmp(*this);
tmp += other;
return tmp;
}
@@ -387,7 +387,7 @@
inline String8 String8::operator+(const char* other) const
{
- String8 tmp;
+ String8 tmp(*this);
tmp += other;
return tmp;
}