| Index: pkg/analyzer/test/src/util/absolute_path_test.dart
|
| diff --git a/pkg/analyzer/test/src/util/absolute_path_test.dart b/pkg/analyzer/test/src/util/absolute_path_test.dart
|
| index 0f195c2ad98612c01b1056ff98519fd17049c469..420cba9ca8d92d7c3f04d5e8624c1ec934faa1f9 100644
|
| --- a/pkg/analyzer/test/src/util/absolute_path_test.dart
|
| +++ b/pkg/analyzer/test/src/util/absolute_path_test.dart
|
| @@ -18,7 +18,7 @@ main() {
|
|
|
| @reflectiveTest
|
| class AbsolutePathContextPosixTest {
|
| - AbsolutePathContext context = new AbsolutePathContext(r'/');
|
| + AbsolutePathContext context = new AbsolutePathContext(false);
|
|
|
| void test_append() {
|
| expect(context.append(r'/path/to', r'foo.dart'), r'/path/to/foo.dart');
|
| @@ -38,6 +38,27 @@ class AbsolutePathContextPosixTest {
|
| expect(context.dirname(r'/'), r'/');
|
| }
|
|
|
| + void test_isValid_absolute() {
|
| + expect(context.isValid(r'/foo/bar'), isTrue);
|
| + expect(context.isValid(r'/foo'), isTrue);
|
| + expect(context.isValid(r'/'), isTrue);
|
| + expect(context.isValid(r''), isFalse);
|
| + expect(context.isValid(r'foo/bar'), isFalse);
|
| + }
|
| +
|
| + void test_isValid_normalized() {
|
| + expect(context.isValid(r'/foo/bar'), isTrue);
|
| + expect(context.isValid(r'/foo/..bar'), isTrue);
|
| + expect(context.isValid(r'/foo/.bar/baz'), isTrue);
|
| + expect(context.isValid(r'/foo/...'), isTrue);
|
| + expect(context.isValid(r'/foo/.../bar'), isTrue);
|
| + expect(context.isValid(r'/foo/.bar/.'), isFalse);
|
| + expect(context.isValid(r'/foo/bar/../baz'), isFalse);
|
| + expect(context.isValid(r'/foo/bar/..'), isFalse);
|
| + expect(context.isValid(r'/foo/./bar'), isFalse);
|
| + expect(context.isValid(r'/.'), isFalse);
|
| + }
|
| +
|
| void test_isWithin() {
|
| expect(context.isWithin(r'/root/path', r'/root/path/a'), isTrue);
|
| expect(context.isWithin(r'/root/path', r'/root/other'), isFalse);
|
| @@ -57,7 +78,7 @@ class AbsolutePathContextPosixTest {
|
|
|
| @reflectiveTest
|
| class AbsolutePathContextWindowsTest {
|
| - AbsolutePathContext context = new AbsolutePathContext(r'\');
|
| + AbsolutePathContext context = new AbsolutePathContext(true);
|
|
|
| void test_append() {
|
| expect(context.append(r'C:\path\to', r'foo.dart'), r'C:\path\to\foo.dart');
|
| @@ -77,6 +98,29 @@ class AbsolutePathContextWindowsTest {
|
| expect(context.dirname(r'C:\'), r'C:\');
|
| }
|
|
|
| + void test_isValid_absolute() {
|
| + expect(context.isValid(r'C:\foo\bar'), isTrue);
|
| + expect(context.isValid(r'c:\foo\bar'), isTrue);
|
| + expect(context.isValid(r'D:\foo\bar'), isTrue);
|
| + expect(context.isValid(r'C:\foo'), isTrue);
|
| + expect(context.isValid(r'C:\'), isTrue);
|
| + expect(context.isValid(r''), isFalse);
|
| + expect(context.isValid(r'foo\bar'), isFalse);
|
| + }
|
| +
|
| + void test_isValid_normalized() {
|
| + expect(context.isValid(r'C:\foo\bar'), isTrue);
|
| + expect(context.isValid(r'C:\foo\..bar'), isTrue);
|
| + expect(context.isValid(r'C:\foo\.bar\baz'), isTrue);
|
| + expect(context.isValid(r'C:\foo\...'), isTrue);
|
| + expect(context.isValid(r'C:\foo\...\bar'), isTrue);
|
| + expect(context.isValid(r'C:\foo\.bar\.'), isFalse);
|
| + expect(context.isValid(r'C:\foo\bar\..\baz'), isFalse);
|
| + expect(context.isValid(r'C:\foo\bar\..'), isFalse);
|
| + expect(context.isValid(r'C:\foo\.\bar'), isFalse);
|
| + expect(context.isValid(r'C:\.'), isFalse);
|
| + }
|
| +
|
| void test_isWithin() {
|
| expect(context.isWithin(r'C:\root\path', r'C:\root\path\a'), isTrue);
|
| expect(context.isWithin(r'C:\root\path', r'C:\root\other'), isFalse);
|
|
|