| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.analyzer.src.util.absolute_path; | 5 library test.analyzer.src.util.absolute_path; |
| 6 | 6 |
| 7 import 'package:analyzer/src/util/absolute_path.dart'; | 7 import 'package:analyzer/src/util/absolute_path.dart'; |
| 8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 9 | 9 |
| 10 import '../../reflective_tests.dart'; | 10 import '../../reflective_tests.dart'; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 expect(context.isWithin(r'/root/path', r'/root/other'), isFalse); | 43 expect(context.isWithin(r'/root/path', r'/root/other'), isFalse); |
| 44 expect(context.isWithin(r'/root/path', r'/root/path'), isFalse); | 44 expect(context.isWithin(r'/root/path', r'/root/path'), isFalse); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void test_split() { | 47 void test_split() { |
| 48 expect(context.split(r'/path/to/foo'), [r'', r'path', r'to', r'foo']); | 48 expect(context.split(r'/path/to/foo'), [r'', r'path', r'to', r'foo']); |
| 49 expect(context.split(r'/path'), [r'', r'path']); | 49 expect(context.split(r'/path'), [r'', r'path']); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void test_suffix() { | 52 void test_suffix() { |
| 53 expect(context.suffix(r'/root/path/a/b.dart', r'/root/path'), r'a/b.dart'); | 53 expect(context.suffix(r'/root/path', r'/root/path/a/b.dart'), r'a/b.dart'); |
| 54 expect(context.suffix(r'/root/other.dart', r'/root/path'), isNull); | 54 expect(context.suffix(r'/root/path', r'/root/other.dart'), isNull); |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 @reflectiveTest | 58 @reflectiveTest |
| 59 class AbsolutePathContextWindowsTest { | 59 class AbsolutePathContextWindowsTest { |
| 60 AbsolutePathContext context = new AbsolutePathContext(r'\'); | 60 AbsolutePathContext context = new AbsolutePathContext(r'\'); |
| 61 | 61 |
| 62 void test_append() { | 62 void test_append() { |
| 63 expect(context.append(r'C:\path\to', r'foo.dart'), r'C:\path\to\foo.dart'); | 63 expect(context.append(r'C:\path\to', r'foo.dart'), r'C:\path\to\foo.dart'); |
| 64 } | 64 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 83 expect(context.isWithin(r'C:\root\path', r'C:\root\path'), isFalse); | 83 expect(context.isWithin(r'C:\root\path', r'C:\root\path'), isFalse); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void test_split() { | 86 void test_split() { |
| 87 expect(context.split(r'C:\path\to\foo'), [r'C:', r'path', r'to', r'foo']); | 87 expect(context.split(r'C:\path\to\foo'), [r'C:', r'path', r'to', r'foo']); |
| 88 expect(context.split(r'C:\path'), [r'C:', r'path']); | 88 expect(context.split(r'C:\path'), [r'C:', r'path']); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void test_suffix() { | 91 void test_suffix() { |
| 92 expect( | 92 expect( |
| 93 context.suffix(r'C:\root\path\a\b.dart', r'C:\root\path'), r'a\b.dart'); | 93 context.suffix(r'C:\root\path', r'C:\root\path\a\b.dart'), r'a\b.dart'); |
| 94 expect(context.suffix(r'C:\root\other.dart', r'C:\root\path'), isNull); | 94 expect(context.suffix(r'C:\root\path', r'C:\root\other.dart'), isNull); |
| 95 } | 95 } |
| 96 } | 96 } |
| OLD | NEW |