From 2cf04119102753e92b5dc09cd3820f5f15d4022f Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 11 May 2021 16:27:15 -0700 Subject: Remove String16::remove. This function, ironically, is being removed. Even more amusing, it was never "remove" anyway --- it literally did the opposite, and removed everything *except* the range you passed to it, and should probably have been called "keep"! I'm looking at reimplementing much of libutils, but first I'm improving test coverage, and literally every test I wrote for this failed. And then when I fixed the "obvious bugs" in the implementation, I found there actually were a couple of existing unit tests --- that mostly served to demonstrate just how counter-intuitive this function was. Bug: http://b/156999009 Test: treehugger Change-Id: I41fd85f7c0988070f4039f607d2e57523d862ed9 --- libutils/String16_test.cpp | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'libutils/String16_test.cpp') diff --git a/libutils/String16_test.cpp b/libutils/String16_test.cpp index c2e9b02cd..54662ac41 100644 --- a/libutils/String16_test.cpp +++ b/libutils/String16_test.cpp @@ -90,13 +90,6 @@ TEST(String16Test, Insert) { EXPECT_STR16EQ(u"VerifyInsert me", tmp); } -TEST(String16Test, Remove) { - String16 tmp("Verify me"); - tmp.remove(2, 6); - EXPECT_EQ(2U, tmp.size()); - EXPECT_STR16EQ(u" m", tmp); -} - TEST(String16Test, ReplaceAll) { String16 tmp("Verify verify Verify"); tmp.replaceAll(u'r', u'!'); @@ -161,14 +154,6 @@ TEST(String16Test, StaticStringInsert) { EXPECT_FALSE(tmp.isStaticString()); } -TEST(String16Test, StaticStringRemove) { - StaticString16 tmp(u"Verify me"); - tmp.remove(2, 6); - EXPECT_EQ(2U, tmp.size()); - EXPECT_STR16EQ(u" m", tmp); - EXPECT_FALSE(tmp.isStaticString()); -} - TEST(String16Test, StaticStringReplaceAll) { StaticString16 tmp(u"Verify verify Verify"); tmp.replaceAll(u'r', u'!'); -- cgit v1.2.3