Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: third_party/WebKit/Source/wtf/text/StringConcatenateTest.cpp

Issue 2315853002: Massively simplify WTF's StringConcatenate (Closed)
Patch Set: missing inlines. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 17 matching lines...) Expand all
28 static int wtfStringCopyCount; 28 static int wtfStringCopyCount;
29 29
30 #include "testing/gtest/include/gtest/gtest.h" 30 #include "testing/gtest/include/gtest/gtest.h"
31 #include "wtf/text/WTFString.h" 31 #include "wtf/text/WTFString.h"
32 32
33 namespace WTF { 33 namespace WTF {
34 34
35 #define EXPECT_N_WTF_STRING_COPIES(count, expr) \ 35 #define EXPECT_N_WTF_STRING_COPIES(count, expr) \
36 do { \ 36 do { \
37 wtfStringCopyCount = 0; \ 37 wtfStringCopyCount = 0; \
38 String __testString = expr; \ 38 String testString = expr; \
39 (void)__testString; \ 39 (void)testString; \
40 EXPECT_EQ(count, wtfStringCopyCount) << #expr; \ 40 EXPECT_EQ(count, wtfStringCopyCount) << #expr; \
41 } while (false) 41 } while (false)
42 42
43 TEST(StringOperatorsTest, DISABLED_StringOperators) 43 // TODO(esprehn): Fix or delete this test.
44 TEST(StringConcatenateTest, DISABLED_StringCopies)
44 { 45 {
45 String string("String"); 46 String string("String");
46 AtomicString atomicString("AtomicString"); 47 AtomicString atomicString("AtomicString");
47 const char* literal = "ASCIILiteral"; 48 const char* literal = "ASCIILiteral";
48 49
49 EXPECT_EQ(0, wtfStringCopyCount); 50 EXPECT_EQ(0, wtfStringCopyCount);
50 51
51 EXPECT_N_WTF_STRING_COPIES(2, string + string); 52 EXPECT_N_WTF_STRING_COPIES(2, string + string);
52 EXPECT_N_WTF_STRING_COPIES(2, string + atomicString); 53 EXPECT_N_WTF_STRING_COPIES(2, string + atomicString);
53 EXPECT_N_WTF_STRING_COPIES(2, atomicString + string); 54 EXPECT_N_WTF_STRING_COPIES(2, atomicString + string);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 EXPECT_N_WTF_STRING_COPIES(2, L"wide string" + atomicString + L"wide string" + string); 178 EXPECT_N_WTF_STRING_COPIES(2, L"wide string" + atomicString + L"wide string" + string);
178 EXPECT_N_WTF_STRING_COPIES(2, L"wide string" + (atomicString + L"wide string " + string)); 179 EXPECT_N_WTF_STRING_COPIES(2, L"wide string" + (atomicString + L"wide string " + string));
179 EXPECT_N_WTF_STRING_COPIES(2, (L"wide string" + atomicString) + (L"wide stri ng" + string)); 180 EXPECT_N_WTF_STRING_COPIES(2, (L"wide string" + atomicString) + (L"wide stri ng" + string));
180 EXPECT_N_WTF_STRING_COPIES(2, atomicString + L"wide string" + string + L"wid e string"); 181 EXPECT_N_WTF_STRING_COPIES(2, atomicString + L"wide string" + string + L"wid e string");
181 EXPECT_N_WTF_STRING_COPIES(2, atomicString + (L"wide string" + string + L"wi de string")); 182 EXPECT_N_WTF_STRING_COPIES(2, atomicString + (L"wide string" + string + L"wi de string"));
182 EXPECT_N_WTF_STRING_COPIES(2, (atomicString + L"wide string") + (string + L" wide string")); 183 EXPECT_N_WTF_STRING_COPIES(2, (atomicString + L"wide string") + (string + L" wide string"));
183 #endif 184 #endif
184 } 185 }
185 186
186 } // namespace WTF 187 } // namespace WTF
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698