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

Delta Between Two Patch Sets: test/plugin/UtilTest.cpp

Issue 29332775: Issue #1234 - Remove 'CString' From 'ToLowerString()' (Closed)
Left Patch Set: Created Dec. 15, 2015, 9:10 p.m.
Right Patch Set: address comments, round two Created Jan. 7, 2016, 2:32 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/plugin/PluginUtil.cpp ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 74
75 TEST(ToLowerString, Empty) 75 TEST(ToLowerString, Empty)
76 { 76 {
77 ASSERT_EQ(std::wstring(), ToLowerString(L"")); 77 ASSERT_EQ(L"", ToLowerString(L""));
sergei 2015/12/16 10:32:45 It's still not clear why we are using ASSERT in a
Eric 2015/12/16 13:53:27 Because I prefer ASSERT. And as I've said before,
78 } 78 }
79 79
80 TEST(ToLowerString, NotEmpty) 80 TEST(ToLowerString, NotEmpty)
81 { 81 {
82 ASSERT_EQ(std::wstring(L"foo"), ToLowerString(L"Foo")); 82 ASSERT_EQ(L"foobar", ToLowerString(L"FooBAR"));
sergei 2015/12/16 10:32:45 Is it necessary to explicitly construct std::wstri
Eric 2015/12/16 13:53:27 I checked. No. They were in there because I've ha
83 } 83 }
84 84
85 TEST(ToLowerString, NullWithExtra) 85 TEST(ToLowerString, NullWithExtra)
86 { 86 {
87 ASSERT_EQ(std::wstring(L"\0BAR"), ToLowerString(L"\0BAR")); 87 std::wstring input(L"\0BAR", 4);
sergei 2015/12/16 10:32:45 I think this test and below are incorrect. Mainly
Eric 2015/12/16 13:53:27 Yep. Fixed that. I keep forgetting that constructi
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()));
88 } 95 }
89 96
90 TEST(ToLowerString, InternalNull) 97 TEST(ToLowerString, InternalNull)
91 { 98 {
92 ASSERT_EQ(std::wstring(L"foo\0BAR"), ToLowerString(L"Foo\0BAR")); 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()));
93 } 107 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld