Fix typos
[TortoiseGit.git] / test / UnitTests / StringUtilsTest.cpp
blob9521e51bae8d539cdb0b3cc8594d3d55a977532d
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2015-2017, 2021, 2023 - TortoiseGit
4 // Copyright (C) 2003-2011 - TortoiseSVN
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include "stdafx.h"
22 #include "StringUtils.h"
24 TEST(CStringUtils, WordWrap)
26 CString longline = L"this is a test of how a string can be splitted into several lines";
27 CString splittedline = CStringUtils::WordWrap(longline, 10, true, false, 4);
28 EXPECT_STREQ(L"this is a\n test of\n how a\n string\n can be\n splitted\n into\n several\n lines", splittedline);
29 longline = L"c:\\this_is_a_very_long\\path_on_windows and of course some other words added to make the line longer";
30 splittedline = CStringUtils::WordWrap(longline, 10, true, false, 4);
31 EXPECT_STREQ(L"...\\pat...\n and of\n course\n some\n other\n words\n added to\n make the\n line\n longer", splittedline);
32 longline = L"Forced failure in https://myserver.com/a_long_url_to_split PROPFIND error";
33 splittedline = CStringUtils::WordWrap(longline, 20, true, false, 4);
34 EXPECT_STREQ(L"Forced failure in\n https://myserver.com/a_long_url_to_split\n PROPFIND error", splittedline);
35 longline = L"Forced\nfailure in https://myserver.com/a_long_url_to_split PROPFIND\nerror";
36 splittedline = CStringUtils::WordWrap(longline, 40, true, false, 4);
37 EXPECT_STREQ(L"Forced\nfailure in\n https://myserver.com/a_long_url_to_split\n PROPFIND\nerror", splittedline);
38 longline = L"Failed to add file\nc:\\export\\spare\\Devl-JBoss\\development\\head\\src\\something\\CoreApplication\\somethingelse\\src\\com\\yetsomthingelse\\shipper\\DAO\\ShipmentInfoDAO1.java\nc:\\export\\spare\\Devl-JBoss\\development\\head\\src\\something\\CoreApplication\\somethingelse\\src\\com\\yetsomthingelse\\shipper\\DAO\\ShipmentInfoDAO2.java";
39 splittedline = CStringUtils::WordWrap(longline, 80, true, false, 4);
40 EXPECT_STREQ(L"Failed to add\n file\nc:\\export\\spare\\Devl-JBoss\\development\\head\\src\\something\\CoreApplication\\somethingelse\\src\\com\\yetsomthingelse\\shipper\\DAO\\ShipmentInfoDAO1.java\nc:\\export\\spare\\Devl-JBoss\\development\\head\\src\\something\\CoreApplication\\somethingelse\\src\\com\\yetsomthing\n", splittedline);
43 TEST(CStringUtils, LinesWrap)
45 CString longline = L"this is a test of how a string can be splitted into several lines";
46 CString splittedline = CStringUtils::LinesWrap(longline, 10, true);
47 EXPECT_STREQ(L"this is a\n test of\n how a\n string\n can be\n splitted\n into\n several\n lines", splittedline);
48 longline = L"c:\\this_is_a_very_long\\path_on_windows and of course some other words added to make the line longer";
49 splittedline = CStringUtils::LinesWrap(longline, 10);
50 EXPECT_STREQ(L"c:\\this_is_a_very_long\\path_on_windows\n and of\n course\n some\n other\n words\n added to\n make the\n line\n longer", splittedline);
51 longline = L"Forced failure in https://myserver.com/a_long_url_to_split PROPFIND error";
52 splittedline = CStringUtils::LinesWrap(longline, 20, true);
53 EXPECT_STREQ(L"Forced failure in\n https://myserver.com/a_long_url_to_split\n PROPFIND error", splittedline);
54 longline = L"Forced\nfailure in https://myserver.com/a_long_url_to_split PROPFIND\nerror";
55 splittedline = CStringUtils::LinesWrap(longline, 40);
56 EXPECT_STREQ(L"Forced\nfailure in\n https://myserver.com/a_long_url_to_split\n PROPFIND\nerror", splittedline);
57 longline = L"Failed to add file\nc:\\export\\spare\\Devl-JBoss\\development\\head\\src\\something\\CoreApplication\\somethingelse\\src\\com\\yetsomthingelse\\shipper\\DAO\\ShipmentInfoDAO1.java\nc:\\export\\spare\\Devl-JBoss\\development\\head\\src\\something\\CoreApplication\\somethingelse\\src\\com\\yetsomthingelse\\shipper\\DAO\\ShipmentInfoDAO2.java";
58 splittedline = CStringUtils::LinesWrap(longline);
59 EXPECT_STREQ(L"Failed to add file\nc:\\export\\spare\\Devl-JBoss\\development\\head\\src\\something\\CoreApplication\\somethingelse\\src\\com\\yetsomthingelse\\shipper\\DAO\\ShipmentInfoDAO1.java\n\nc:\\export\\spare\\Devl-JBoss\\development\\head\\src\\something\\CoreApplication\\somethingelse\\src\\com\\yetsomthingelse\\shipper\\DAO\\ShipmentInfoDAO2.java", splittedline);
60 longline = L"The commit comment is not properly formatted.\nFormat:\n Field 1 : Field 2 : Field 3\nWhere:\nField 1 - Team Name|Triage|Merge|Goal\nField 2 - V1 Backlog Item ID|Triage Number|SVNBranch|Goal Name\nField 3 - Description of change\nExamples:\n\nTeam Gamma : B-12345 : Changed some code\n Triage : 123 : Fixed production release bug\n Merge : sprint0812 : Merged sprint0812 into prod\n Goal : Implement Pre-Commit Hook : Commit message hook impl";
61 splittedline = CStringUtils::LinesWrap(longline, 80);
62 EXPECT_STREQ(L"The commit comment is not properly formatted.\nFormat:\n Field 1 : Field 2 : Field 3\nWhere:\nField 1 - Team Name|Triage|Merge|Goal\nField 2 - V1 Backlog Item ID|Triage Number|SVNBranch|Goal Name\nField 3 - Description of change\nExamples:\n\nTeam Gamma : B-12345 : Changed some code\n Triage : 123 : Fixed production release bug\n Merge : sprint0812 : Merged sprint0812 into prod\n Goal : Implement Pre-Commit Hook : Commit message hook impl", splittedline);
65 TEST(CStringUtils, RemoveAccelerators)
67 CString empty;
68 CStringUtils::RemoveAccelerators(empty);
69 EXPECT_STREQ(L"", empty);
71 CString text1 = L"&Accellerator";
72 CStringUtils::RemoveAccelerators(text1);
73 EXPECT_STREQ(L"Accellerator", text1);
75 CString text1a = L"Ac&cellerator";
76 CStringUtils::RemoveAccelerators(text1a);
77 EXPECT_STREQ(L"Accellerator", text1a);
79 CString text2 = L"Accellerator&";
80 CStringUtils::RemoveAccelerators(text2);
81 EXPECT_STREQ(L"Accellerator", text2);
83 CString text3 = L"Some & text";
84 CStringUtils::RemoveAccelerators(text3);
85 EXPECT_STREQ(L"Some & text", text3);
87 CString text4 = L"&&Accellerator";
88 CStringUtils::RemoveAccelerators(text4);
89 EXPECT_STREQ(L"&Accellerator", text4);
91 CString text5 = L"Acce&&&llerator";
92 CStringUtils::RemoveAccelerators(text5);
93 EXPECT_STREQ(L"Acce&llerator", text5);
95 CString text6 = L"Some & te&xt";
96 CStringUtils::RemoveAccelerators(text6);
97 EXPECT_STREQ(L"Some & text", text6);
100 TEST(CStringUtils, GetAccellerator)
102 EXPECT_EQ(L'\0', CStringUtils::GetAccellerator(L""));
103 EXPECT_EQ(L'\0', CStringUtils::GetAccellerator(L"&"));
104 EXPECT_EQ(L'\0', CStringUtils::GetAccellerator(L"NoAccellerator"));
105 EXPECT_EQ(L'A', CStringUtils::GetAccellerator(L"&Accellerator"));
106 EXPECT_EQ(L'C', CStringUtils::GetAccellerator(L"Ac&cellerator"));
107 EXPECT_EQ(L'\0', CStringUtils::GetAccellerator(L"Accellerator&"));
108 EXPECT_EQ(L'\0', CStringUtils::GetAccellerator(L"Accellerator&&"));
109 EXPECT_EQ(L'\0', CStringUtils::GetAccellerator(L"Some & text"));
110 EXPECT_EQ(L'\0', CStringUtils::GetAccellerator(L"&&Accellerator"));
111 EXPECT_EQ(L'L', CStringUtils::GetAccellerator(L"Acce&&&llerator"));
112 EXPECT_EQ(L'X', CStringUtils::GetAccellerator(L"Some & te&xt"));
114 TEST(CStringUtils, ParseEmailAddress)
116 CString mail, name;
117 CStringUtils::ParseEmailAddress(L"", mail, &name);
118 EXPECT_STREQ(L"", mail);
119 EXPECT_STREQ(L"", name);
121 CStringUtils::ParseEmailAddress(L" ", mail, &name);
122 EXPECT_STREQ(L"", mail);
123 EXPECT_STREQ(L"", name);
125 mail.Empty();
126 CStringUtils::ParseEmailAddress(L"test@example.com ", mail);
127 EXPECT_STREQ(L"test@example.com", mail);
129 mail.Empty();
130 CStringUtils::ParseEmailAddress(L" test@example.com", mail);
131 EXPECT_STREQ(L"test@example.com", mail);
133 mail.Empty();
134 CStringUtils::ParseEmailAddress(L"test@example.com", mail);
135 EXPECT_STREQ(L"test@example.com", mail);
137 mail.Empty();
138 CStringUtils::ParseEmailAddress(L"John Doe <johndoe>", mail);
139 EXPECT_STREQ(L"johndoe", mail);
141 mail.Empty();
142 name.Empty();
143 CStringUtils::ParseEmailAddress(L"test@example.com", mail, &name);
144 EXPECT_STREQ(L"test@example.com", mail);
145 EXPECT_STREQ(L"test@example.com", name);
147 mail.Empty();
148 name.Empty();
149 CStringUtils::ParseEmailAddress(L"<test@example.com>", mail, &name);
150 EXPECT_STREQ(L"test@example.com", mail);
151 EXPECT_STREQ(L"test@example.com", name);
153 mail.Empty();
154 name.Empty();
155 CStringUtils::ParseEmailAddress(L"John Doe <test@example.com>", mail, &name);
156 EXPECT_STREQ(L"test@example.com", mail);
157 EXPECT_STREQ(L"John Doe", name);
159 mail.Empty();
160 name.Empty();
161 CStringUtils::ParseEmailAddress(L"\"John Doe\" <test@example.com>", mail, &name);
162 EXPECT_STREQ(L"test@example.com", mail);
163 EXPECT_STREQ(L"John Doe", name);
165 mail.Empty();
166 name.Empty();
167 CStringUtils::ParseEmailAddress(L"<test@example.com", mail, &name);
168 EXPECT_STREQ(L"test@example.com", mail);
169 EXPECT_STREQ(L"test@example.com", name);
171 mail.Empty();
172 name.Empty();
173 CStringUtils::ParseEmailAddress(L"test@example.com>", mail, &name);
174 EXPECT_STREQ(L"test@example.com", mail);
175 EXPECT_STREQ(L"test@example.com", name);
177 mail.Empty();
178 name.Empty();
179 CStringUtils::ParseEmailAddress(L"John Doe <johndoe>", mail, &name);
180 EXPECT_STREQ(L"johndoe", mail);
181 EXPECT_STREQ(L"John Doe", name);
183 mail.Empty();
184 name.Empty();
185 CStringUtils::ParseEmailAddress(L"john.doe@example.com (John Doe)", mail, &name);
186 EXPECT_STREQ(L"john.doe@example.com", mail);
187 EXPECT_STREQ(L"John Doe", name);
189 mail.Empty();
190 name.Empty();
191 CStringUtils::ParseEmailAddress(L"John (zzz) Doe <john.doe@example.com> (Comment)", mail, &name);
192 EXPECT_STREQ(L"john.doe@example.com", mail);
193 EXPECT_STREQ(L"John (zzz) Doe (Comment)", name);
195 mail.Empty();
196 name.Empty();
197 CStringUtils::ParseEmailAddress(L"\"john.doe@example.com >> John Doe\" <john.doe@example.com>", mail, &name);
198 EXPECT_STREQ(L"john.doe@example.com", mail);
199 EXPECT_STREQ(L"john.doe@example.com >> John Doe", name);
201 mail.Empty();
202 name.Empty();
203 CStringUtils::ParseEmailAddress(L"\"John<something> Doe\" <john.doe@example.com>", mail, &name);
204 EXPECT_STREQ(L"john.doe@example.com", mail);
205 EXPECT_STREQ(L"John<something> Doe", name);
207 mail.Empty();
208 name.Empty();
209 CStringUtils::ParseEmailAddress(L"\"John<something@example.com> Doe\" <john.doe@example.com>", mail, &name);
210 EXPECT_STREQ(L"john.doe@example.com", mail);
211 EXPECT_STREQ(L"John<something@example.com> Doe", name);
213 mail.Empty();
214 name.Empty();
215 CStringUtils::ParseEmailAddress(L"\"something@example.com\" <john.doe@example.com>", mail, &name);
216 EXPECT_STREQ(L"john.doe@example.com", mail);
217 EXPECT_STREQ(L"something@example.com", name);
219 mail.Empty();
220 name.Empty();
221 CStringUtils::ParseEmailAddress(L"\"John D\\\"o\\\"e\" <john.doe@example.com>", mail, &name);
222 EXPECT_STREQ(L"john.doe@example.com", mail);
223 EXPECT_STREQ(L"John D\"o\"e", name);
225 mail.Empty();
226 name.Empty();
227 CStringUtils::ParseEmailAddress(L"<test@example.com> \"John Doe\"", mail, &name);
228 EXPECT_STREQ(L"test@example.com", mail);
229 EXPECT_STREQ(L"John Doe", name);
232 TEST(CStringUtils, IsPlainReadableASCII)
234 EXPECT_TRUE(CStringUtils::IsPlainReadableASCII(L""));
235 EXPECT_TRUE(CStringUtils::IsPlainReadableASCII(L" 1234,#+*.:-&!\\<>|\"$%&/()=567890abcdefSBDUDB[](!}~"));
236 EXPECT_FALSE(CStringUtils::IsPlainReadableASCII(L"\n"));
237 EXPECT_FALSE(CStringUtils::IsPlainReadableASCII(L"\u2302"));
238 EXPECT_FALSE(CStringUtils::IsPlainReadableASCII(L"é"));
239 EXPECT_FALSE(CStringUtils::IsPlainReadableASCII(L"\u2550"));
240 EXPECT_FALSE(CStringUtils::IsPlainReadableASCII(L"ä"));
241 EXPECT_FALSE(CStringUtils::IsPlainReadableASCII(L"€"));
242 EXPECT_FALSE(CStringUtils::IsPlainReadableASCII(L"\u570B"));
243 EXPECT_FALSE(CStringUtils::IsPlainReadableASCII(L"\u7ACB"));
246 TEST(CStringUtils, StartsWith)
248 EXPECT_TRUE(CStringUtils::StartsWith(L"", L""));
249 EXPECT_FALSE(CStringUtils::StartsWith(L"", L"sometest"));
251 CString heystack = L"sometest";
252 EXPECT_TRUE(CStringUtils::StartsWith(heystack, L"sometest"));
253 EXPECT_TRUE(CStringUtils::StartsWith(heystack, L""));
254 EXPECT_TRUE(CStringUtils::StartsWith(heystack, L"sometes"));
255 EXPECT_FALSE(CStringUtils::StartsWith(heystack, L"sometEs"));
256 EXPECT_FALSE(CStringUtils::StartsWith(heystack, L"someteste"));
257 EXPECT_FALSE(CStringUtils::StartsWith(heystack, L"sometess"));
259 CString empty;
260 CString sometest = L"sometest";
261 CString sometes = L"sometes";
262 CString sometEs = L"sometEs";
263 CString someteste = L"someteste";
264 CString sometess = L"sometess";
265 EXPECT_TRUE(CStringUtils::StartsWith(heystack, sometest));
266 EXPECT_TRUE(CStringUtils::StartsWith(heystack, empty));
267 EXPECT_TRUE(CStringUtils::StartsWith(heystack, sometes));
268 EXPECT_FALSE(CStringUtils::StartsWith(heystack, sometEs));
269 EXPECT_FALSE(CStringUtils::StartsWith(heystack, someteste));
270 EXPECT_FALSE(CStringUtils::StartsWith(heystack, sometess));
271 EXPECT_FALSE(CStringUtils::StartsWith(empty, sometess));
274 TEST(CStringUtils, StartsWithI)
276 EXPECT_TRUE(CStringUtils::StartsWithI(L"", L""));
277 EXPECT_FALSE(CStringUtils::StartsWithI(L"", L"sometest"));
279 CString heystack = L"someTest";
280 EXPECT_TRUE(CStringUtils::StartsWithI(heystack, L"sometest"));
281 EXPECT_TRUE(CStringUtils::StartsWithI(heystack, L"someTest"));
282 EXPECT_TRUE(CStringUtils::StartsWithI(heystack, L"sOmetest"));
283 EXPECT_TRUE(CStringUtils::StartsWithI(heystack, L""));
284 EXPECT_TRUE(CStringUtils::StartsWithI(heystack, L"sometEs"));
285 EXPECT_FALSE(CStringUtils::StartsWithI(heystack, L"sometesTe"));
286 EXPECT_FALSE(CStringUtils::StartsWithI(heystack, L"someteSs"));
288 CString empty;
289 CString sometest = L"someteSt";
290 CString sometes = L"soMetes";
291 CString someteste = L"sOmeteste";
292 CString sometess = L"sometesS";
293 EXPECT_TRUE(CStringUtils::StartsWithI(heystack, sometest));
294 EXPECT_TRUE(CStringUtils::StartsWithI(heystack, empty));
295 EXPECT_TRUE(CStringUtils::StartsWithI(heystack, sometes));
296 EXPECT_FALSE(CStringUtils::StartsWithI(heystack, someteste));
297 EXPECT_FALSE(CStringUtils::StartsWithI(heystack, sometess));
298 EXPECT_FALSE(CStringUtils::StartsWithI(empty, sometess));
301 TEST(CStringUtils, StartsWithA)
303 EXPECT_TRUE(CStringUtils::StartsWith("", ""));
304 EXPECT_FALSE(CStringUtils::StartsWith("", "sometest"));
306 CStringA heystack = L"sometest";
307 EXPECT_TRUE(CStringUtils::StartsWith(heystack, "sometest"));
308 EXPECT_TRUE(CStringUtils::StartsWith(heystack, ""));
309 EXPECT_TRUE(CStringUtils::StartsWith(heystack, "sometes"));
310 EXPECT_FALSE(CStringUtils::StartsWith(heystack, "someTe"));
311 EXPECT_FALSE(CStringUtils::StartsWith(heystack, "someteste"));
312 EXPECT_FALSE(CStringUtils::StartsWith(heystack, "sometess"));
315 TEST(CStringUtils, EndsWith)
317 EXPECT_TRUE(CStringUtils::EndsWith(L"", L""));
318 EXPECT_FALSE(CStringUtils::EndsWith(L"", L"sometest"));
320 CString heystack = L"sometest";
321 EXPECT_TRUE(CStringUtils::EndsWith(heystack, L"sometest"));
322 EXPECT_TRUE(CStringUtils::EndsWith(heystack, L"test"));
323 EXPECT_TRUE(CStringUtils::EndsWith(heystack, L"st"));
324 EXPECT_TRUE(CStringUtils::EndsWith(heystack, L"t"));
325 EXPECT_TRUE(CStringUtils::EndsWith(heystack, L""));
326 EXPECT_FALSE(CStringUtils::EndsWith(heystack, L"teSt"));
327 EXPECT_FALSE(CStringUtils::EndsWith(heystack, L"esometest"));
328 EXPECT_FALSE(CStringUtils::EndsWith(heystack, L"someteste"));
329 EXPECT_FALSE(CStringUtils::EndsWith(heystack, L"text"));
330 EXPECT_FALSE(CStringUtils::EndsWith(heystack, L"xt"));
332 EXPECT_TRUE(CStringUtils::EndsWith(heystack, L't'));
333 EXPECT_FALSE(CStringUtils::EndsWith(heystack, L'T'));
334 EXPECT_FALSE(CStringUtils::EndsWith(heystack, L'x'));
337 TEST(CStringUtils, EndsWithI)
339 EXPECT_TRUE(CStringUtils::EndsWithI(L"", L""));
340 EXPECT_FALSE(CStringUtils::EndsWithI(L"", L"sometest"));
342 CString heystack = L"sometest";
343 EXPECT_TRUE(CStringUtils::EndsWithI(heystack, L"someteSt"));
344 EXPECT_TRUE(CStringUtils::EndsWithI(heystack, L"tEst"));
345 EXPECT_TRUE(CStringUtils::EndsWithI(heystack, L"sT"));
346 EXPECT_TRUE(CStringUtils::EndsWithI(heystack, L"T"));
347 EXPECT_TRUE(CStringUtils::EndsWithI(heystack, L""));
348 EXPECT_FALSE(CStringUtils::EndsWithI(heystack, L"esometEst"));
349 EXPECT_FALSE(CStringUtils::EndsWithI(heystack, L"someteSte"));
350 EXPECT_FALSE(CStringUtils::EndsWithI(heystack, L"text"));
351 EXPECT_FALSE(CStringUtils::EndsWithI(heystack, L"xt"));
354 TEST(CStringUtils, UnescapeGitQuotePath)
356 EXPECT_STREQ(L"", CStringUtils::UnescapeGitQuotePath(L""));
358 EXPECT_STREQ(L"ascii.txt", CStringUtils::UnescapeGitQuotePath(L"ascii.txt"));
359 EXPECT_STREQ(L"ümlauts.txt", CStringUtils::UnescapeGitQuotePath(L"\\303\\274mlauts.txt"));
360 EXPECT_STREQ(L"umläütß", CStringUtils::UnescapeGitQuotePath(L"uml\\303\\244\\303\\274t\\303\\237"));
362 // taken from Git tests:
363 EXPECT_STREQ(L"\u6FF1\u91CE/file", CStringUtils::UnescapeGitQuotePath(L"\\346\\277\\261\\351\\207\\216/file"));
364 EXPECT_STREQ(L"\u6FF1\u91CE\u7D14", CStringUtils::UnescapeGitQuotePath(L"\\346\\277\\261\\351\\207\\216\\347\\264\\224"));
367 TEST(CStringUtils, EnsureCRLF)
369 EXPECT_STREQ(L"", CStringUtils::EnsureCRLF(L""));
370 EXPECT_STREQ(L"\r\n", CStringUtils::EnsureCRLF(L"\n"));
371 EXPECT_STREQ(L"\r\n", CStringUtils::EnsureCRLF(L"\r\n"));
372 EXPECT_STREQ(L"\r\n", CStringUtils::EnsureCRLF(L"\r"));
373 EXPECT_STREQ(L"Some\r\nthing", CStringUtils::EnsureCRLF(L"Some\nthing"));
374 EXPECT_STREQ(L"Some\r\nthing", CStringUtils::EnsureCRLF(L"Some\rthing"));
375 EXPECT_STREQ(L"Some\r\nthing\r\n", CStringUtils::EnsureCRLF(L"Some\nthing\n"));
376 EXPECT_STREQ(L"Some\\nthing", CStringUtils::EnsureCRLF(L"Some\\nthing"));
377 EXPECT_STREQ(L"Some\r\n\r\nthing\r\n", CStringUtils::EnsureCRLF(L"Some\n\nthing\n"));
378 EXPECT_STREQ(L"Some\r\n\r\nthing\r\n", CStringUtils::EnsureCRLF(L"Some\r\r\nthing\r"));
379 EXPECT_STREQ(L"Some\r\nthing\r\n", CStringUtils::EnsureCRLF(L"Some\r\nthing\n"));
380 EXPECT_STREQ(L"Some\r\nthing\r\n", CStringUtils::EnsureCRLF(L"Some\r\nthing\r"));
381 EXPECT_STREQ(L"\r\nSome\r\n\r\nthing\r\n", CStringUtils::EnsureCRLF(L"\nSome\r\n\nthing\n"));
382 EXPECT_STREQ(L"\r\nSome\r\n\r\n\r\nthing\r\n", CStringUtils::EnsureCRLF(L"\nSome\r\r\n\nthing\n"));
383 EXPECT_STREQ(L"\r\nSome\r\n\r\n\r\nthing\r\n", CStringUtils::EnsureCRLF(L"\nSome\r\r\n\rthing\n"));
384 EXPECT_STREQ(L"\r\nSome\r\n\r\nthing\r\n", CStringUtils::EnsureCRLF(L"\nSome\r\n\r\nthing\n"));
385 EXPECT_STREQ(L"\r\nSome\r\n\r\nthing\r\n", CStringUtils::EnsureCRLF(L"\nSome\r\n\rthing\r"));
386 EXPECT_STREQ(L"\r\nSome\r\n\r\n\r\nthing\r\n", CStringUtils::EnsureCRLF(L"\nSome\n\r\rthing\n"));