diff options
-rw-r--r-- | source/fud_string.cpp | 2 | ||||
-rw-r--r-- | test/test_string.cpp | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/source/fud_string.cpp b/source/fud_string.cpp index cd35bdb..27496ff 100644 --- a/source/fud_string.cpp +++ b/source/fud_string.cpp @@ -64,7 +64,7 @@ String::String(const char* cString) m_capacity = m_length + 1; m_data = static_cast<utf8*>(fudAlloc(m_capacity)); fudAssert(m_data != nullptr); - fudAssert(copyMem(m_buffer.data(), m_capacity, cString, m_length) == FudStatus::Success); + fudAssert(copyMem(m_data, m_capacity, cString, m_length) == FudStatus::Success); fudAssert(nullTerminate() == FudStatus::Success); } } diff --git a/test/test_string.cpp b/test/test_string.cpp index 3b8c3aa..d48112b 100644 --- a/test/test_string.cpp +++ b/test/test_string.cpp @@ -53,6 +53,13 @@ TEST(FudString, BasicStringOps) ASSERT_TRUE(view2.nullTerminated()); } +TEST(FudString, HeapAlloc) +{ + constexpr const char filenameLiteral[] = "Amazing Saga Volume 01/000.jpg"; + fud::String filename{filenameLiteral}; + ASSERT_EQ(filename.length(), sizeof(filenameLiteral) - 1); +} + #if 0 TEST(FudString, FindSubstringCxx) { |