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

Side by Side Diff: mojo/public/cpp/bindings/tests/string_unittest.cc

Issue 294833002: Mojo: more idiomatic C++ bindings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698