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

Side by Side 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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/plugin/PluginUtil.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 TEST(BeginsWith, ExtraBad) 65 TEST(BeginsWith, ExtraBad)
66 { 66 {
67 ASSERT_FALSE(BeginsWithForTesting(L"foo", L"foobar")); 67 ASSERT_FALSE(BeginsWithForTesting(L"foo", L"foobar"));
68 } 68 }
69 69
70 TEST(BeginsWith, LongerBad) 70 TEST(BeginsWith, LongerBad)
71 { 71 {
72 ASSERT_FALSE(BeginsWithForTesting(L"foo", L"barfoo")); 72 ASSERT_FALSE(BeginsWithForTesting(L"foo", L"barfoo"));
73 } 73 }
74
75 TEST(ToLowerString, Empty)
76 {
77 ASSERT_EQ(L"", ToLowerString(L""));
78 }
79
80 TEST(ToLowerString, NotEmpty)
81 {
82 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
83 }
84
85 TEST(ToLowerString, NullWithExtra)
86 {
87 std::wstring input(L"\0BAR", 4);
88 ASSERT_EQ(4, input.length());
89
90 std::wstring actual;
91 ASSERT_NO_THROW({ actual = ToLowerString(input); });
92 // White-box tests for further verification of no-crash behavior
93 ASSERT_EQ(4, actual.length());
94 ASSERT_EQ(L"", std::wstring(actual.c_str()));
95 }
96
97 TEST(ToLowerString, InternalNull)
98 {
99 std::wstring input(L"Foo\0BAR", 7);
100 ASSERT_EQ(7, input.length());
101
102 std::wstring actual;
103 ASSERT_NO_THROW({ actual = ToLowerString(input); });
104 // White-box tests for further verification of no-crash behavior
105 ASSERT_EQ(7, actual.length());
106 ASSERT_EQ(L"foo", std::wstring(actual.c_str()));
107 }
OLDNEW
« 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