OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "mojo/public/cpp/bindings/string.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 |
| 8 namespace mojo { |
| 9 namespace test { |
| 10 namespace { |
| 11 |
| 12 } // namespace |
| 13 |
| 14 TEST(StringTest, Null) { |
| 15 String s; |
| 16 EXPECT_TRUE(s.is_null()); |
| 17 } |
| 18 |
| 19 TEST(StringTest, Basic) { |
| 20 String s("hello world"); |
| 21 EXPECT_EQ(std::string("hello world"), s.get()); |
| 22 } |
| 23 |
| 24 TEST(StringTest, Pass) { |
| 25 String s("hello world"); |
| 26 String t = s.Pass(); |
| 27 EXPECT_FALSE(t.is_null()); |
| 28 EXPECT_EQ(std::string("hello world"), t.get()); |
| 29 EXPECT_TRUE(s.is_null()); |
| 30 } |
| 31 |
| 32 TEST(StringTest, Equality) { |
| 33 String s("hello world"); |
| 34 String t("hello world"); |
| 35 EXPECT_EQ(s, t); |
| 36 EXPECT_TRUE(s == t); |
| 37 EXPECT_TRUE("hello world" == s); |
| 38 EXPECT_TRUE(s == "hello world"); |
| 39 EXPECT_TRUE("not" != s); |
| 40 EXPECT_TRUE(s != "not"); |
| 41 } |
| 42 |
| 43 } // namespace test |
| 44 } // namespace mojo |
OLD | NEW |