Title: [191236] trunk/Tools
Revision
191236
Author
akl...@apple.com
Date
2015-10-16 21:48:50 -0700 (Fri, 16 Oct 2015)

Log Message

[EFL, AppleWin] WTF.ConcatenateCharacterArrayAndEmptyString API test failed
<https://webkit.org/b/150153>

Unreviewed.

Just use simple arrays of LChar and UChar for this test instead of creating String
objects and then getting the characters8()/characters16() from them, since that
doesn't guarantee null-termination (the bug.)

* TestWebKitAPI/Tests/WTF/StringOperators.cpp:
(TestWebKitAPI::TEST):
(TestWebKitAPI::build): Deleted.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (191235 => 191236)


--- trunk/Tools/ChangeLog	2015-10-17 04:37:16 UTC (rev 191235)
+++ trunk/Tools/ChangeLog	2015-10-17 04:48:50 UTC (rev 191236)
@@ -1,3 +1,18 @@
+2015-10-16  Andreas Kling  <akl...@apple.com>
+
+        [EFL, AppleWin] WTF.ConcatenateCharacterArrayAndEmptyString API test failed
+        <https://webkit.org/b/150153>
+
+        Unreviewed.
+
+        Just use simple arrays of LChar and UChar for this test instead of creating String
+        objects and then getting the characters8()/characters16() from them, since that
+        doesn't guarantee null-termination (the bug.)
+
+        * TestWebKitAPI/Tests/WTF/StringOperators.cpp:
+        (TestWebKitAPI::TEST):
+        (TestWebKitAPI::build): Deleted.
+
 2015-10-16  Tim Horton  <timothy_hor...@apple.com>
 
         WebKit2.AutoLayoutIntegration API test is failing on some of the bots

Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/StringOperators.cpp (191235 => 191236)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/StringOperators.cpp	2015-10-17 04:37:16 UTC (rev 191235)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/StringOperators.cpp	2015-10-17 04:48:50 UTC (rev 191236)
@@ -29,18 +29,10 @@
 
 static int wtfStringCopyCount;
 
-#include <wtf/text/StringBuilder.h>
 #include <wtf/text/WTFString.h>
 
 namespace TestWebKitAPI {
 
-static void build(StringBuilder& builder, std::vector<UChar> input)
-{
-    builder.clear();
-    for (auto codeUnit : input)
-        builder.append(codeUnit);
-}
-
 #define EXPECT_N_WTF_STRING_COPIES(count, expr) \
     do { \
         wtfStringCopyCount = 0; \
@@ -194,23 +186,18 @@
 
 TEST(WTF, ConcatenateCharacterArrayAndEmptyString)
 {
-    StringBuilder b;
+    String emptyString;
+    EXPECT_EQ(static_cast<unsigned>(0), emptyString.length());
 
-    build(b, {0x9FF0, 0x868D, 'M', 'E'});
-    String sixteenBitString = b.toString();
-    EXPECT_FALSE(sixteenBitString.is8Bit());
-    String concatenation = sixteenBitString.characters16() + String();
-    ASSERT_EQ(sixteenBitString.length(), static_cast<unsigned>(4));
-    ASSERT_EQ(concatenation.length(), static_cast<unsigned>(4));
-    ASSERT_TRUE(concatenation == sixteenBitString);
+    UChar ucharArray[] = { 't', 'e', 's', 't', '\0' };
+    String concatenation16 = ucharArray + emptyString;
+    ASSERT_EQ(static_cast<unsigned>(4), concatenation16.length());
+    ASSERT_TRUE(concatenation16 == String(ucharArray));
 
-    build(b, {'P', 'L', 'S'});
-    String eightBitString = b.toString();
-    EXPECT_TRUE(eightBitString.is8Bit());
-    String concatenation8 = eightBitString.characters8() + String();
-    ASSERT_EQ(eightBitString.length(), static_cast<unsigned>(3));
-    ASSERT_EQ(concatenation8.length(), static_cast<unsigned>(3));
-    ASSERT_TRUE(concatenation8 == eightBitString);
+    LChar lcharArray[] = { 't', 'e', 's', 't', '\0' };
+    String concatenation8 = lcharArray + emptyString;
+    ASSERT_EQ(static_cast<unsigned>(4), concatenation8.length());
+    ASSERT_TRUE(concatenation8 == String(lcharArray));
 }
 
 } // namespace TestWebKitAPI
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to