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

Unified Diff: base/string_piece_unittest.cc

Issue 8846001: Add iterator range constructors to StringPiece. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove extra blank line. Created 9 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/string_piece.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/string_piece_unittest.cc
diff --git a/base/string_piece_unittest.cc b/base/string_piece_unittest.cc
index 1362d4e5c7d58bb3dfa85e2714b1948d48e90ea0..b95b6eeaaac5f2c064851b013d4d7e45e003b1ef 100644
--- a/base/string_piece_unittest.cc
+++ b/base/string_piece_unittest.cc
@@ -653,4 +653,22 @@ TEST(StringPiece16Test, CheckConversion) {
"\xf0\x9d\x84\x9e");
}
+TYPED_TEST(CommonStringPieceTest, CheckConstructors) {
+ TypeParam str(TestFixture::as_string("hello world"));
+ TypeParam empty;
+
+ ASSERT_TRUE(str == BasicStringPiece<TypeParam>(str));
+ ASSERT_TRUE(str == BasicStringPiece<TypeParam>(str.c_str()));
+ ASSERT_TRUE(TestFixture::as_string("hello") ==
+ BasicStringPiece<TypeParam>(str.c_str(), 5));
+ ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(str.c_str(), 0));
+ ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(NULL));
+ ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(NULL, 0));
+ ASSERT_TRUE(empty == BasicStringPiece<TypeParam>());
+ ASSERT_TRUE(str == BasicStringPiece<TypeParam>(str.begin(), str.end()));
+ ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(str.begin(), str.begin()));
+ ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(empty));
+ ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(empty.begin(), empty.end()));
+}
+
} // namespace base
« no previous file with comments | « base/string_piece.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698