| 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_services/src/correction/strings.dart'; | 7 import 'package:analysis_services/src/correction/strings.dart'; |
| 8 import 'package:analysis_testing/reflective_tests.dart'; | 8 import 'package:analysis_testing/reflective_tests.dart'; |
| 9 import 'package:unittest/unittest.dart' hide isEmpty; | 9 import 'package:unittest/unittest.dart' hide isEmpty; |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 } | 27 } |
| 28 | 28 |
| 29 void test_compareStrings() { | 29 void test_compareStrings() { |
| 30 expect(compareStrings(null, null), 0); | 30 expect(compareStrings(null, null), 0); |
| 31 expect(compareStrings(null, 'b'), 1); | 31 expect(compareStrings(null, 'b'), 1); |
| 32 expect(compareStrings('a', null), -1); | 32 expect(compareStrings('a', null), -1); |
| 33 expect(compareStrings('a', 'b'), -1); | 33 expect(compareStrings('a', 'b'), -1); |
| 34 expect(compareStrings('b', 'a'), 1); | 34 expect(compareStrings('b', 'a'), 1); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void test_format() { | |
| 38 expect(format('Hello, {0}!', 'John'), 'Hello, John!'); | |
| 39 expect( | |
| 40 format('{0} are you {1}ing?', 'What', 'read'), | |
| 41 'What are you reading?'); | |
| 42 } | |
| 43 | |
| 44 void test_isBlank() { | 37 void test_isBlank() { |
| 45 expect(isBlank(null), isTrue); | 38 expect(isBlank(null), isTrue); |
| 46 expect(isBlank(''), isTrue); | 39 expect(isBlank(''), isTrue); |
| 47 expect(isBlank(' '), isTrue); | 40 expect(isBlank(' '), isTrue); |
| 48 expect(isBlank('\t'), isTrue); | 41 expect(isBlank('\t'), isTrue); |
| 49 expect(isBlank(' '), isTrue); | 42 expect(isBlank(' '), isTrue); |
| 50 expect(isBlank('X'), isFalse); | 43 expect(isBlank('X'), isFalse); |
| 51 } | 44 } |
| 52 | 45 |
| 53 void test_isDigit() { | 46 void test_isDigit() { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 expect(removeStart('abcTest', 'abc'), 'Test'); | 136 expect(removeStart('abcTest', 'abc'), 'Test'); |
| 144 expect(removeStart('my abcTest', 'abc'), 'my abcTest'); | 137 expect(removeStart('my abcTest', 'abc'), 'my abcTest'); |
| 145 } | 138 } |
| 146 | 139 |
| 147 void test_repeat() { | 140 void test_repeat() { |
| 148 expect(repeat('x', 0), ''); | 141 expect(repeat('x', 0), ''); |
| 149 expect(repeat('x', 5), 'xxxxx'); | 142 expect(repeat('x', 5), 'xxxxx'); |
| 150 expect(repeat('abc', 3), 'abcabcabc'); | 143 expect(repeat('abc', 3), 'abcabcabc'); |
| 151 } | 144 } |
| 152 } | 145 } |
| OLD | NEW |