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 analyzer.test.src.util.absolute_path_test; | 5 library analyzer.test.src.util.absolute_path_test; |
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 expect(context.isValid(r'/'), isTrue); | 44 expect(context.isValid(r'/'), isTrue); |
45 expect(context.isValid(r''), isFalse); | 45 expect(context.isValid(r''), isFalse); |
46 expect(context.isValid(r'foo/bar'), isFalse); | 46 expect(context.isValid(r'foo/bar'), isFalse); |
47 } | 47 } |
48 | 48 |
49 void test_isValid_normalized() { | 49 void test_isValid_normalized() { |
50 expect(context.isValid(r'/foo/bar'), isTrue); | 50 expect(context.isValid(r'/foo/bar'), isTrue); |
51 expect(context.isValid(r'/foo/..bar'), isTrue); | 51 expect(context.isValid(r'/foo/..bar'), isTrue); |
52 expect(context.isValid(r'/foo/.bar/baz'), isTrue); | 52 expect(context.isValid(r'/foo/.bar/baz'), isTrue); |
53 expect(context.isValid(r'/foo/...'), isTrue); | 53 expect(context.isValid(r'/foo/...'), isTrue); |
| 54 expect(context.isValid(r'/foo/bar..'), isTrue); |
54 expect(context.isValid(r'/foo/.../bar'), isTrue); | 55 expect(context.isValid(r'/foo/.../bar'), isTrue); |
55 expect(context.isValid(r'/foo/.bar/.'), isFalse); | 56 expect(context.isValid(r'/foo/.bar/.'), isFalse); |
56 expect(context.isValid(r'/foo/bar/../baz'), isFalse); | 57 expect(context.isValid(r'/foo/bar/../baz'), isFalse); |
57 expect(context.isValid(r'/foo/bar/..'), isFalse); | 58 expect(context.isValid(r'/foo/bar/..'), isFalse); |
58 expect(context.isValid(r'/foo/./bar'), isFalse); | 59 expect(context.isValid(r'/foo/./bar'), isFalse); |
59 expect(context.isValid(r'/.'), isFalse); | 60 expect(context.isValid(r'/.'), isFalse); |
60 } | 61 } |
61 | 62 |
62 void test_isWithin() { | 63 void test_isWithin() { |
63 expect(context.isWithin(r'/root/path', r'/root/path/a'), isTrue); | 64 expect(context.isWithin(r'/root/path', r'/root/path/a'), isTrue); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 expect(context.isValid(r'C:\'), isTrue); | 107 expect(context.isValid(r'C:\'), isTrue); |
107 expect(context.isValid(r''), isFalse); | 108 expect(context.isValid(r''), isFalse); |
108 expect(context.isValid(r'foo\bar'), isFalse); | 109 expect(context.isValid(r'foo\bar'), isFalse); |
109 } | 110 } |
110 | 111 |
111 void test_isValid_normalized() { | 112 void test_isValid_normalized() { |
112 expect(context.isValid(r'C:\foo\bar'), isTrue); | 113 expect(context.isValid(r'C:\foo\bar'), isTrue); |
113 expect(context.isValid(r'C:\foo\..bar'), isTrue); | 114 expect(context.isValid(r'C:\foo\..bar'), isTrue); |
114 expect(context.isValid(r'C:\foo\.bar\baz'), isTrue); | 115 expect(context.isValid(r'C:\foo\.bar\baz'), isTrue); |
115 expect(context.isValid(r'C:\foo\...'), isTrue); | 116 expect(context.isValid(r'C:\foo\...'), isTrue); |
| 117 expect(context.isValid(r'C:\foo\bar..'), isTrue); |
116 expect(context.isValid(r'C:\foo\...\bar'), isTrue); | 118 expect(context.isValid(r'C:\foo\...\bar'), isTrue); |
117 expect(context.isValid(r'C:\foo\.bar\.'), isFalse); | 119 expect(context.isValid(r'C:\foo\.bar\.'), isFalse); |
118 expect(context.isValid(r'C:\foo\bar\..\baz'), isFalse); | 120 expect(context.isValid(r'C:\foo\bar\..\baz'), isFalse); |
119 expect(context.isValid(r'C:\foo\bar\..'), isFalse); | 121 expect(context.isValid(r'C:\foo\bar\..'), isFalse); |
120 expect(context.isValid(r'C:\foo\.\bar'), isFalse); | 122 expect(context.isValid(r'C:\foo\.\bar'), isFalse); |
121 expect(context.isValid(r'C:\.'), isFalse); | 123 expect(context.isValid(r'C:\.'), isFalse); |
122 } | 124 } |
123 | 125 |
124 void test_isWithin() { | 126 void test_isWithin() { |
125 expect(context.isWithin(r'C:\root\path', r'C:\root\path\a'), isTrue); | 127 expect(context.isWithin(r'C:\root\path', r'C:\root\path\a'), isTrue); |
126 expect(context.isWithin(r'C:\root\path', r'C:\root\other'), isFalse); | 128 expect(context.isWithin(r'C:\root\path', r'C:\root\other'), isFalse); |
127 expect(context.isWithin(r'C:\root\path', r'C:\root\path'), isFalse); | 129 expect(context.isWithin(r'C:\root\path', r'C:\root\path'), isFalse); |
128 } | 130 } |
129 | 131 |
130 void test_split() { | 132 void test_split() { |
131 expect(context.split(r'C:\path\to\foo'), [r'C:', r'path', r'to', r'foo']); | 133 expect(context.split(r'C:\path\to\foo'), [r'C:', r'path', r'to', r'foo']); |
132 expect(context.split(r'C:\path'), [r'C:', r'path']); | 134 expect(context.split(r'C:\path'), [r'C:', r'path']); |
133 } | 135 } |
134 | 136 |
135 void test_suffix() { | 137 void test_suffix() { |
136 expect( | 138 expect( |
137 context.suffix(r'C:\root\path', r'C:\root\path\a\b.dart'), r'a\b.dart'); | 139 context.suffix(r'C:\root\path', r'C:\root\path\a\b.dart'), r'a\b.dart'); |
138 expect(context.suffix(r'C:\root\path', r'C:\root\other.dart'), isNull); | 140 expect(context.suffix(r'C:\root\path', r'C:\root\other.dart'), isNull); |
139 } | 141 } |
140 } | 142 } |
OLD | NEW |