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 engine.utilities_test; | 5 library engine.utilities_test; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/src/generated/ast.dart'; | 9 import 'package:analyzer/src/generated/ast.dart'; |
10 import 'package:analyzer/src/generated/java_core.dart'; | 10 import 'package:analyzer/src/generated/java_core.dart'; |
(...skipping 4548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4559 } | 4559 } |
4560 | 4560 |
4561 void test_toString() { | 4561 void test_toString() { |
4562 SourceRange r = new SourceRange(10, 1); | 4562 SourceRange r = new SourceRange(10, 1); |
4563 expect(r.toString(), "[offset=10, length=1]"); | 4563 expect(r.toString(), "[offset=10, length=1]"); |
4564 } | 4564 } |
4565 } | 4565 } |
4566 | 4566 |
4567 @reflectiveTest | 4567 @reflectiveTest |
4568 class StringUtilitiesTest { | 4568 class StringUtilitiesTest { |
| 4569 void test_computeLineStarts_n() { |
| 4570 List<int> starts = StringUtilities.computeLineStarts('a\nbb\nccc'); |
| 4571 expect(starts, <int>[0, 2, 5]); |
| 4572 } |
| 4573 |
| 4574 void test_computeLineStarts_r() { |
| 4575 List<int> starts = StringUtilities.computeLineStarts('a\rbb\rccc'); |
| 4576 expect(starts, <int>[0, 2, 5]); |
| 4577 } |
| 4578 |
| 4579 void test_computeLineStarts_rn() { |
| 4580 List<int> starts = StringUtilities.computeLineStarts('a\r\nbb\r\nccc'); |
| 4581 expect(starts, <int>[0, 3, 7]); |
| 4582 } |
| 4583 |
4569 void test_EMPTY() { | 4584 void test_EMPTY() { |
4570 expect(StringUtilities.EMPTY, ""); | 4585 expect(StringUtilities.EMPTY, ""); |
4571 expect(StringUtilities.EMPTY.isEmpty, isTrue); | 4586 expect(StringUtilities.EMPTY.isEmpty, isTrue); |
4572 } | 4587 } |
4573 | 4588 |
4574 void test_EMPTY_ARRAY() { | 4589 void test_EMPTY_ARRAY() { |
4575 expect(StringUtilities.EMPTY_ARRAY.length, 0); | 4590 expect(StringUtilities.EMPTY_ARRAY.length, 0); |
4576 } | 4591 } |
4577 | 4592 |
4578 void test_endsWith3() { | 4593 void test_endsWith3() { |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4828 } | 4843 } |
4829 | 4844 |
4830 void test_get_added() { | 4845 void test_get_added() { |
4831 TokenMap tokenMap = new TokenMap(); | 4846 TokenMap tokenMap = new TokenMap(); |
4832 Token key = TokenFactory.tokenFromType(TokenType.AT); | 4847 Token key = TokenFactory.tokenFromType(TokenType.AT); |
4833 Token value = TokenFactory.tokenFromType(TokenType.AT); | 4848 Token value = TokenFactory.tokenFromType(TokenType.AT); |
4834 tokenMap.put(key, value); | 4849 tokenMap.put(key, value); |
4835 expect(tokenMap.get(key), same(value)); | 4850 expect(tokenMap.get(key), same(value)); |
4836 } | 4851 } |
4837 } | 4852 } |
OLD | NEW |