diff options
Diffstat (limited to 'tests/unit_tests/wipeable_string.cpp')
-rw-r--r-- | tests/unit_tests/wipeable_string.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/unit_tests/wipeable_string.cpp b/tests/unit_tests/wipeable_string.cpp index f1bb90a41..9eecd509a 100644 --- a/tests/unit_tests/wipeable_string.cpp +++ b/tests/unit_tests/wipeable_string.cpp @@ -211,3 +211,15 @@ TEST(wipeable_string, to_hex) ASSERT_TRUE(epee::to_hex::wipeable_string(epee::span<const uint8_t>((const uint8_t*)"", 0)) == epee::wipeable_string("")); ASSERT_TRUE(epee::to_hex::wipeable_string(epee::span<const uint8_t>((const uint8_t*)"abc", 3)) == epee::wipeable_string("616263")); } + +TEST(wipeable_string, to_string) +{ + // Converting a wipeable_string to a string defeats the purpose of wipeable_string, + // but nice to know this works + std::string str; + { + epee::wipeable_string wipeable_str("foo"); + str = std::string(wipeable_str.data(), wipeable_str.size()); + } + ASSERT_TRUE(str == std::string("foo")); +} |