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

Unified Diff: mojo/public/cpp/bindings/tests/string_unittest.cc

Issue 2250183003: Make the fuchsia mojo/public repo the source of truth. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/cpp/bindings/tests/string_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/string_unittest.cc b/mojo/public/cpp/bindings/tests/string_unittest.cc
deleted file mode 100644
index ca0c7414df7d4c01f3a4cdd1f4e563cb07a29c14..0000000000000000000000000000000000000000
--- a/mojo/public/cpp/bindings/tests/string_unittest.cc
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <sstream>
-
-#include "gtest/gtest.h"
-#include "mojo/public/cpp/bindings/string.h"
-
-namespace mojo {
-namespace test {
-
-TEST(StringTest, DefaultIsNull) {
- String s;
- EXPECT_TRUE(s.is_null());
-}
-
-TEST(StringTest, ConstructedWithNull) {
- String s(nullptr);
- EXPECT_TRUE(s.is_null());
-}
-
-TEST(StringTest, ConstructedWithNullCharPointer) {
- const char* null = nullptr;
- String s(null);
- EXPECT_TRUE(s.is_null());
-}
-
-TEST(StringTest, AssignedNull) {
- String s("");
- EXPECT_FALSE(s.is_null());
- s = nullptr;
- EXPECT_TRUE(s.is_null());
-}
-
-TEST(StringTest, AssignedNullCharPointer) {
- String s("");
- EXPECT_FALSE(s.is_null());
- const char* null = nullptr;
- s = null;
- EXPECT_TRUE(s.is_null());
-}
-
-TEST(StringTest, Empty) {
- String s("");
- EXPECT_FALSE(s.is_null());
- EXPECT_TRUE(s.get().empty());
-}
-
-TEST(StringTest, Basic) {
- String s("hello world");
- EXPECT_EQ(std::string("hello world"), s.get());
-}
-
-TEST(StringTest, Assignment) {
- String s("hello world");
- String t = s; // Makes a copy.
- EXPECT_FALSE(t.is_null());
- EXPECT_EQ(std::string("hello world"), t.get());
- EXPECT_FALSE(s.is_null());
-}
-
-TEST(StringTest, ConstAt) {
- const String s("abc");
- EXPECT_EQ('a', s.at(0));
- EXPECT_EQ('b', s.at(1));
- EXPECT_EQ('c', s.at(2));
-}
-
-TEST(StringTest, NonConstAt) {
- String s("abc");
- EXPECT_EQ('a', s.at(0));
- EXPECT_EQ('b', s.at(1));
- s.at(0) = 'x';
- s.at(1) = 'y';
- EXPECT_EQ('x', s.at(0));
- EXPECT_EQ('y', s.at(1));
- EXPECT_EQ('c', s.at(2));
-}
-
-TEST(StringTest, ConstArraySubscript) {
- const String s("abc");
- EXPECT_EQ('a', s[0]);
- EXPECT_EQ('b', s[1]);
- EXPECT_EQ('c', s[2]);
-}
-
-TEST(StringTest, NonConstArraySubscript) {
- String s("abc");
- EXPECT_EQ('a', s[0]);
- EXPECT_EQ('b', s[1]);
- s[0] = 'x';
- s[1] = 'y';
- EXPECT_EQ('x', s[0]);
- EXPECT_EQ('y', s[1]);
- EXPECT_EQ('c', s[2]);
-}
-
-TEST(StringTest, Equality) {
- String s("hello world");
- String t("hello world");
- EXPECT_EQ(s, t);
- EXPECT_TRUE(s == t);
- EXPECT_TRUE("hello world" == s);
- EXPECT_TRUE(s == "hello world");
- EXPECT_TRUE("not" != s);
- EXPECT_TRUE(s != "not");
-}
-
-TEST(StringTest, LessThanNullness) {
- String null;
- String null2;
- EXPECT_FALSE(null < null2);
- EXPECT_FALSE(null2 < null);
-
- String real("real");
- EXPECT_TRUE(null < real);
- EXPECT_FALSE(real < null);
-}
-
-TEST(StringTest, OutputFormatting) {
- String s("abc");
- String null;
-
- std::ostringstream so;
- so << "s=" << s << ", null=" << null;
- EXPECT_EQ("s=abc, null=", so.str());
-}
-
-} // namespace test
-} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698