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

Unified Diff: testing/gtest_mac_unittest.mm

Issue 3028047: This adds adds four macros when compiling using GTEST_OS_MAC: (Closed)
Patch Set: Fix compile Created 10 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
« testing/gtest_mac.mm ('K') | « testing/gtest_mac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/gtest_mac_unittest.mm
diff --git a/testing/gtest_mac_unittest.mm b/testing/gtest_mac_unittest.mm
new file mode 100644
index 0000000000000000000000000000000000000000..552beeebca9c242edcebeacec18763c42c1fd450
--- /dev/null
+++ b/testing/gtest_mac_unittest.mm
@@ -0,0 +1,47 @@
+// Copyright (c) 2010 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.
+
+// Note that while this file is in testing/ and tests GTest macros, it is built
+// as part of Chromium's unit_tests target because the project does not build
+// or run GTest's internal test suite.
+
+#import "testing/gtest_mac.h"
+
+#import <Foundation/Foundation.h>
+
+#include "base/scoped_nsautorelease_pool.h"
+#include "testing/gtest/include/gtest/internal/gtest-port.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+TEST(GTestMac, ExpectNSEQ) {
+ base::ScopedNSAutoreleasePool pool;
+
+ EXPECT_NSEQ(@"a", @"a");
+
+ NSString* s1 = [NSString stringWithUTF8String:"a"];
+ NSString* s2 = [NSString stringWithString:@"a"];
+ EXPECT_NE(s1, s2);
+ EXPECT_NSEQ(s1, s2);
+}
+
+TEST(GTestMac, AssertNSEQ) {
+ base::ScopedNSAutoreleasePool pool;
+
+ NSNumber* n1 = [NSNumber numberWithInt:42];
+ NSNumber* n2 = [NSNumber numberWithInt:42];
+ EXPECT_NE(n1, n2);
Avi (use Gerrit) 2010/08/05 23:51:15 Is this a valid assumption?
+ ASSERT_NSEQ(n1, n2);
+}
+
+TEST(GTestMac, ExpectNSNE) {
+ base::ScopedNSAutoreleasePool pool;
+
+ EXPECT_NSNE([NSNumber numberWithInt:2], [NSNumber numberWithInt:42]);
+}
+
+TEST(GTestMac, AssertNSNE) {
+ base::ScopedNSAutoreleasePool pool;
+
+ ASSERT_NSNE(@"a", @"b");
+}
« testing/gtest_mac.mm ('K') | « testing/gtest_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698