Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: test/plugin/UtilTest.cpp

Issue 29332775: Issue #1234 - Remove 'CString' From 'ToLowerString()' (Closed)
Patch Set: address comments, round two Created Jan. 7, 2016, 2:32 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/plugin/PluginUtil.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"foobar", ToLowerString(L"FooBAR"));
+}
+
+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()));
+}
« no previous file with comments | « src/plugin/PluginUtil.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld