Index: test/plugin/UtilTest.cpp |
=================================================================== |
--- a/test/plugin/UtilTest.cpp |
+++ b/test/plugin/UtilTest.cpp |
@@ -71,3 +71,37 @@ |
{ |
ASSERT_FALSE(BeginsWithForTesting(L"foo", L"barfoo")); |
} |
+ |
+TEST(ToLowerString, Empty) |
+{ |
+ ASSERT_EQ(L"", ToLowerString(L"")); |
+} |
+ |
+TEST(ToLowerString, NotEmpty) |
+{ |
+ ASSERT_EQ(L"foo", ToLowerString(L"Foo")); |
Oleksandr
2016/01/05 22:59:00
Nit: why not test "FOO" instead? To make sure not
Eric
2016/01/07 14:34:04
Changed. Generally, when you partially modify data
|
+} |
+ |
+TEST(ToLowerString, NullWithExtra) |
+{ |
+ std::wstring input(L"\0BAR", 4); |
+ ASSERT_EQ(4, input.length()); |
+ |
+ std::wstring actual; |
+ ASSERT_NO_THROW({ actual = ToLowerString(input); }); |
+ // White-box tests for further verification of no-crash behavior |
+ ASSERT_EQ(4, actual.length()); |
+ ASSERT_EQ(L"", std::wstring(actual.c_str())); |
+} |
+ |
+TEST(ToLowerString, InternalNull) |
+{ |
+ std::wstring input(L"Foo\0BAR", 7); |
+ ASSERT_EQ(7, input.length()); |
+ |
+ std::wstring actual; |
+ ASSERT_NO_THROW({ actual = ToLowerString(input); }); |
+ // White-box tests for further verification of no-crash behavior |
+ ASSERT_EQ(7, actual.length()); |
+ ASSERT_EQ(L"foo", std::wstring(actual.c_str())); |
+} |