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 Created Dec. 16, 2015, 4:35 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"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()));
+}
« 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