OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Note that while this file is in testing/ and tests GTest macros, it is built | 5 // Note that while this file is in testing/ and tests GTest macros, it is built |
6 // as part of Chromium's unit_tests target because the project does not build | 6 // as part of Chromium's unit_tests target because the project does not build |
7 // or run GTest's internal test suite. | 7 // or run GTest's internal test suite. |
8 | 8 |
9 #import "testing/gtest_mac.h" | 9 #import "testing/gtest_mac.h" |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 NSString* s1 = [NSString stringWithUTF8String:"a"]; | 22 NSString* s1 = [NSString stringWithUTF8String:"a"]; |
23 NSString* s2 = @"a"; | 23 NSString* s2 = @"a"; |
24 EXPECT_NE(s1, s2); | 24 EXPECT_NE(s1, s2); |
25 EXPECT_NSEQ(s1, s2); | 25 EXPECT_NSEQ(s1, s2); |
26 } | 26 } |
27 | 27 |
28 TEST(GTestMac, AssertNSEQ) { | 28 TEST(GTestMac, AssertNSEQ) { |
29 base::mac::ScopedNSAutoreleasePool pool; | 29 base::mac::ScopedNSAutoreleasePool pool; |
30 | 30 |
31 NSNumber* n1 = [NSNumber numberWithInt:42]; | 31 NSString* s1 = [NSString stringWithUTF8String:"a"]; |
32 NSNumber* n2 = [NSNumber numberWithInt:42]; | 32 NSString* s2 = @"a"; |
33 EXPECT_NE(n1, n2); | 33 EXPECT_NE(s1, s2); |
34 ASSERT_NSEQ(n1, n2); | 34 ASSERT_NSEQ(s1, s2); |
35 } | 35 } |
36 | 36 |
37 TEST(GTestMac, ExpectNSNE) { | 37 TEST(GTestMac, ExpectNSNE) { |
38 base::mac::ScopedNSAutoreleasePool pool; | 38 base::mac::ScopedNSAutoreleasePool pool; |
39 | 39 |
40 EXPECT_NSNE([NSNumber numberWithInt:2], [NSNumber numberWithInt:42]); | 40 EXPECT_NSNE([NSNumber numberWithInt:2], [NSNumber numberWithInt:42]); |
41 } | 41 } |
42 | 42 |
43 TEST(GTestMac, AssertNSNE) { | 43 TEST(GTestMac, AssertNSNE) { |
44 base::mac::ScopedNSAutoreleasePool pool; | 44 base::mac::ScopedNSAutoreleasePool pool; |
45 | 45 |
46 ASSERT_NSNE(@"a", @"b"); | 46 ASSERT_NSNE(@"a", @"b"); |
47 } | 47 } |
48 | 48 |
49 TEST(GTestMac, ExpectNSNil) { | 49 TEST(GTestMac, ExpectNSNil) { |
50 base::mac::ScopedNSAutoreleasePool pool; | 50 base::mac::ScopedNSAutoreleasePool pool; |
51 | 51 |
52 EXPECT_NSEQ(nil, nil); | 52 EXPECT_NSEQ(nil, nil); |
53 EXPECT_NSNE(nil, @"a"); | 53 EXPECT_NSNE(nil, @"a"); |
54 EXPECT_NSNE(@"a", nil); | 54 EXPECT_NSNE(@"a", nil); |
55 | 55 |
56 // TODO(shess): Test that EXPECT_NSNE(nil, nil) fails. | 56 // TODO(shess): Test that EXPECT_NSNE(nil, nil) fails. |
57 } | 57 } |
OLD | NEW |