diff --git a/src/ox/std/string.hpp b/src/ox/std/string.hpp index 4f6c43974..0368f8fca 100644 --- a/src/ox/std/string.hpp +++ b/src/ox/std/string.hpp @@ -114,7 +114,7 @@ constexpr const BString &BString::operator+=(const char *str) noexce template constexpr const BString &BString::operator+=(char *str) noexcept { - return *this = static_cast(str); + return *this += static_cast(str); } template diff --git a/src/ox/std/test/CMakeLists.txt b/src/ox/std/test/CMakeLists.txt index ad9eccb7a..6e9b08752 100644 --- a/src/ox/std/test/CMakeLists.txt +++ b/src/ox/std/test/CMakeLists.txt @@ -11,5 +11,6 @@ add_test("Test\\ ox_memcmp\\ ABCDEFG\\ !=\\ HIJKLMN" StdTest "ABCDEFG != HIJKLMN add_test("Test\\ ox_memcmp\\ HIJKLMN\\ !=\\ ABCDEFG" StdTest "HIJKLMN != ABCDEFG") add_test("Test\\ ox_memcmp\\ ABCDEFG\\ ==\\ ABCDEFG" StdTest "ABCDEFG == ABCDEFG") add_test("Test\\ ox_memcmp\\ ABCDEFGHI\\ ==\\ ABCDEFG" StdTest "ABCDEFGHI == ABCDEFG") +add_test("Test\\ BString" StdTest "BString") add_test("Test\\ Vector" StdTest "Vector") add_test("Test\\ HashMap" StdTest "HashMap") diff --git a/src/ox/std/test/tests.cpp b/src/ox/std/test/tests.cpp index 0904067eb..f5521ee78 100644 --- a/src/ox/std/test/tests.cpp +++ b/src/ox/std/test/tests.cpp @@ -37,6 +37,18 @@ map> tests = { return !(ox_memcmp("ABCDEFGHI", "ABCDEFG", 7) == 0); } }, + { + "BString", + []() { + ox::BString<100> s; + s += "A"; + s += "B"; + s += 9; + s += "C"; + oxAssert(s == "AB9C", "BString append broken"); + return OxError(0); + } + }, { "Vector", [] {