| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library test.services.correction.strings; | 5 library test.services.correction.strings; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/services/correction/strings.dart'; | 7 import 'package:analysis_server/src/services/correction/strings.dart'; |
| 8 import 'package:unittest/unittest.dart' hide isEmpty; | 8 import 'package:unittest/unittest.dart' hide isEmpty; |
| 9 | 9 |
| 10 import '../../reflective_tests.dart'; | 10 import '../../reflective_tests.dart'; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 expect(isWhitespace('A'.codeUnitAt(0)), isFalse); | 124 expect(isWhitespace('A'.codeUnitAt(0)), isFalse); |
| 125 } | 125 } |
| 126 | 126 |
| 127 void test_remove() { | 127 void test_remove() { |
| 128 expect(remove(null, 'x'), null); | 128 expect(remove(null, 'x'), null); |
| 129 expect(remove('abc', null), 'abc'); | 129 expect(remove('abc', null), 'abc'); |
| 130 expect(remove('abc abbc abbbc', 'b'), 'ac ac ac'); | 130 expect(remove('abc abbc abbbc', 'b'), 'ac ac ac'); |
| 131 expect(remove('abc abbc abbbc', 'bc'), 'a ab abb'); | 131 expect(remove('abc abbc abbbc', 'bc'), 'a ab abb'); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void test_removeEnd() { |
| 135 expect(removeEnd(null, 'x'), null); |
| 136 expect(removeEnd('abc', null), 'abc'); |
| 137 expect(removeEnd('www.domain.com', '.com.'), 'www.domain.com'); |
| 138 expect(removeEnd('www.domain.com', 'domain'), 'www.domain.com'); |
| 139 expect(removeEnd('www.domain.com', '.com'), 'www.domain'); |
| 140 } |
| 141 |
| 134 void test_removeStart() { | 142 void test_removeStart() { |
| 135 expect(removeStart(null, 'x'), null); | 143 expect(removeStart(null, 'x'), null); |
| 136 expect(removeStart('abc', null), 'abc'); | 144 expect(removeStart('abc', null), 'abc'); |
| 137 expect(removeStart('abcTest', 'abc'), 'Test'); | 145 expect(removeStart('abcTest', 'abc'), 'Test'); |
| 138 expect(removeStart('my abcTest', 'abc'), 'my abcTest'); | 146 expect(removeStart('my abcTest', 'abc'), 'my abcTest'); |
| 139 } | 147 } |
| 140 | 148 |
| 141 void test_repeat() { | 149 void test_repeat() { |
| 142 expect(repeat('x', 0), ''); | 150 expect(repeat('x', 0), ''); |
| 143 expect(repeat('x', 5), 'xxxxx'); | 151 expect(repeat('x', 5), 'xxxxx'); |
| 144 expect(repeat('abc', 3), 'abcabcabc'); | 152 expect(repeat('abc', 3), 'abcabcabc'); |
| 145 } | 153 } |
| 146 | 154 |
| 147 void test_substringAfterLast() { | 155 void test_substringAfterLast() { |
| 148 expect(substringAfterLast('', '/'), ''); | 156 expect(substringAfterLast('', '/'), ''); |
| 149 expect(substringAfterLast('abc', ''), ''); | 157 expect(substringAfterLast('abc', ''), ''); |
| 150 expect(substringAfterLast('abc', 'd'), 'abc'); | 158 expect(substringAfterLast('abc', 'd'), 'abc'); |
| 151 expect(substringAfterLast('abcbde', 'b'), 'de'); | 159 expect(substringAfterLast('abcbde', 'b'), 'de'); |
| 152 } | 160 } |
| 153 } | 161 } |
| OLD | NEW |