michael@0: // Copyright (c) 2010 The Chromium Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: michael@0: // Note that while this file is in testing/ and tests GTest macros, it is built michael@0: // as part of Chromium's unit_tests target because the project does not build michael@0: // or run GTest's internal test suite. michael@0: michael@0: #import "testing/gtest_mac.h" michael@0: michael@0: #import michael@0: michael@0: #include "base/mac/scoped_nsautorelease_pool.h" michael@0: #include "testing/gtest/include/gtest/internal/gtest-port.h" michael@0: #include "testing/gtest/include/gtest/gtest.h" michael@0: michael@0: TEST(GTestMac, ExpectNSEQ) { michael@0: base::mac::ScopedNSAutoreleasePool pool; michael@0: michael@0: EXPECT_NSEQ(@"a", @"a"); michael@0: michael@0: NSString* s1 = [NSString stringWithUTF8String:"a"]; michael@0: NSString* s2 = [NSString stringWithString:@"a"]; michael@0: EXPECT_NE(s1, s2); michael@0: EXPECT_NSEQ(s1, s2); michael@0: } michael@0: michael@0: TEST(GTestMac, AssertNSEQ) { michael@0: base::mac::ScopedNSAutoreleasePool pool; michael@0: michael@0: NSNumber* n1 = [NSNumber numberWithInt:42]; michael@0: NSNumber* n2 = [NSNumber numberWithInt:42]; michael@0: EXPECT_NE(n1, n2); michael@0: ASSERT_NSEQ(n1, n2); michael@0: } michael@0: michael@0: TEST(GTestMac, ExpectNSNE) { michael@0: base::mac::ScopedNSAutoreleasePool pool; michael@0: michael@0: EXPECT_NSNE([NSNumber numberWithInt:2], [NSNumber numberWithInt:42]); michael@0: } michael@0: michael@0: TEST(GTestMac, AssertNSNE) { michael@0: base::mac::ScopedNSAutoreleasePool pool; michael@0: michael@0: ASSERT_NSNE(@"a", @"b"); michael@0: } michael@0: michael@0: TEST(GTestMac, ExpectNSNil) { michael@0: base::mac::ScopedNSAutoreleasePool pool; michael@0: michael@0: EXPECT_NSEQ(nil, nil); michael@0: EXPECT_NSNE(nil, @"a"); michael@0: EXPECT_NSNE(@"a", nil); michael@0: michael@0: // TODO(shess): Test that EXPECT_NSNE(nil, nil) fails. michael@0: }