Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(559)

Side by Side Diff: pkg/analysis_services/test/correction/strings_test.dart

Issue 464363004: 'Rename Constructor' refactoring. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
11 11
12 12
13 main() { 13 main() {
14 groupSep = ' | '; 14 groupSep = ' | ';
15 runReflectiveTests(StringsTest); 15 runReflectiveTests(StringsTest);
16 } 16 }
17 17
18 18
19 @ReflectiveTestCase() 19 @ReflectiveTestCase()
20 class StringsTest { 20 class StringsTest {
21 void test_capitalize() { 21 void test_capitalize() {
22 expect(capitalize(null), null);
23 expect(capitalize(''), ''); 22 expect(capitalize(''), '');
24 expect(capitalize('a'), 'A'); 23 expect(capitalize('a'), 'A');
25 expect(capitalize('abc'), 'Abc'); 24 expect(capitalize('abc'), 'Abc');
26 expect(capitalize('abc def'), 'Abc def'); 25 expect(capitalize('abc def'), 'Abc def');
27 expect(capitalize('ABC'), 'ABC'); 26 expect(capitalize('ABC'), 'ABC');
28 } 27 }
29 28
30 void test_compareStrings() { 29 void test_compareStrings() {
31 expect(compareStrings(null, null), 0); 30 expect(compareStrings(null, null), 0);
32 expect(compareStrings(null, 'b'), 1); 31 expect(compareStrings(null, 'b'), 1);
33 expect(compareStrings('a', null), -1); 32 expect(compareStrings('a', null), -1);
34 expect(compareStrings('a', 'b'), -1); 33 expect(compareStrings('a', 'b'), -1);
35 expect(compareStrings('b', 'a'), 1); 34 expect(compareStrings('b', 'a'), 1);
36 } 35 }
37 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
38 void test_isBlank() { 44 void test_isBlank() {
39 expect(isBlank(null), isTrue); 45 expect(isBlank(null), isTrue);
40 expect(isBlank(''), isTrue); 46 expect(isBlank(''), isTrue);
41 expect(isBlank(' '), isTrue); 47 expect(isBlank(' '), isTrue);
42 expect(isBlank('\t'), isTrue); 48 expect(isBlank('\t'), isTrue);
43 expect(isBlank(' '), isTrue); 49 expect(isBlank(' '), isTrue);
44 expect(isBlank('X'), isFalse); 50 expect(isBlank('X'), isFalse);
45 } 51 }
46 52
47 void test_isDigit() { 53 void test_isDigit() {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 expect(removeStart('abcTest', 'abc'), 'Test'); 143 expect(removeStart('abcTest', 'abc'), 'Test');
138 expect(removeStart('my abcTest', 'abc'), 'my abcTest'); 144 expect(removeStart('my abcTest', 'abc'), 'my abcTest');
139 } 145 }
140 146
141 void test_repeat() { 147 void test_repeat() {
142 expect(repeat('x', 0), ''); 148 expect(repeat('x', 0), '');
143 expect(repeat('x', 5), 'xxxxx'); 149 expect(repeat('x', 5), 'xxxxx');
144 expect(repeat('abc', 3), 'abcabcabc'); 150 expect(repeat('abc', 3), 'abcabcabc');
145 } 151 }
146 } 152 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698