OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "ios/chrome/common/string_util.h" | 5 #include "ios/chrome/common/string_util.h" |
6 | 6 |
7 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
8 | 8 |
9 #include "base/mac/scoped_nsobject.h" | |
10 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
11 #include "testing/gtest_mac.h" | 10 #include "testing/gtest_mac.h" |
12 #include "testing/platform_test.h" | 11 #include "testing/platform_test.h" |
13 | 12 |
| 13 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 14 #error "This file requires ARC support." |
| 15 #endif |
| 16 |
14 namespace { | 17 namespace { |
15 | 18 |
16 TEST(StringUtilTest, ParseStringWithLink) { | 19 TEST(StringUtilTest, ParseStringWithLink) { |
17 NSArray* const all_test_data = @[ | 20 NSArray* const all_test_data = @[ |
18 @{ | 21 @{ |
19 @"input" : @"Text without link.", | 22 @"input" : @"Text without link.", |
20 @"expected" : @"Text without link.", | 23 @"expected" : @"Text without link.", |
21 @"link range" : [NSValue valueWithRange:NSMakeRange(NSNotFound, 0)] | 24 @"link range" : [NSValue valueWithRange:NSMakeRange(NSNotFound, 0)] |
22 }, | 25 }, |
23 @{ | 26 @{ |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 122 |
120 NSString* leading_calculated = | 123 NSString* leading_calculated = |
121 SubstringOfWidth(long_string, attributes, leading_width, NO); | 124 SubstringOfWidth(long_string, attributes, leading_width, NO); |
122 EXPECT_NSEQ(leading, leading_calculated); | 125 EXPECT_NSEQ(leading, leading_calculated); |
123 | 126 |
124 NSString* trailing_calculated = | 127 NSString* trailing_calculated = |
125 SubstringOfWidth(long_string, attributes, trailing_width, YES); | 128 SubstringOfWidth(long_string, attributes, trailing_width, YES); |
126 EXPECT_NSEQ(trailing, trailing_calculated); | 129 EXPECT_NSEQ(trailing, trailing_calculated); |
127 } | 130 } |
128 } // namespace | 131 } // namespace |
OLD | NEW |