Index: pkg/analyzer/test/src/dart/sdk/sdk_test.dart |
diff --git a/pkg/analyzer/test/src/dart/sdk/sdk_test.dart b/pkg/analyzer/test/src/dart/sdk/sdk_test.dart |
index 214bfa224dc59f06c7b621261b1064e24aa0c6fb..e684880503037e1f658d216c00e76978ebc5317a 100644 |
--- a/pkg/analyzer/test/src/dart/sdk/sdk_test.dart |
+++ b/pkg/analyzer/test/src/dart/sdk/sdk_test.dart |
@@ -527,6 +527,21 @@ final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> { |
}, throwsArgumentError); |
} |
+ void test_readFrom_patches_invalid_path_hasDotDot() { |
+ _assertPathIsInvalid('foo/../bar.dart'); |
+ _assertPathIsInvalid('../foo/bar.dart'); |
+ _assertPathIsInvalid('foo/bar..dart'); |
+ } |
+ |
+ void test_readFrom_patches_invalid_path_isAbsolute() { |
+ _assertPathIsInvalid('/foo.dart'); |
+ _assertPathIsInvalid('/foo/bar.dart'); |
+ } |
+ |
+ void test_readFrom_patches_invalid_path_notPosix() { |
+ _assertPathIsInvalid(r'foo\bar.dart'); |
+ } |
+ |
void test_readFrom_patches_invalid_platformCombinator() { |
expect(() { |
new SdkLibrariesReader(false).readFromFile( |
@@ -571,6 +586,20 @@ final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> { |
expect(library.getPatches(SdkLibraryImpl.VM_PLATFORM), isEmpty); |
expect(library.getPatches(SdkLibraryImpl.DART2JS_PLATFORM), isEmpty); |
} |
+ |
+ void _assertPathIsInvalid(String patchPath) { |
+ expect(() { |
+ new SdkLibrariesReader(false).readFromFile( |
+ resourceProvider.getFile('/libs.dart'), |
+ ''' |
+final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> { |
+ 'foo' : const LibraryInfo( |
+ 'foo/foo.dart', |
+ patches: { |
+ VM_PLATFORM: [r'$patchPath']}), |
+};'''); |
+ }, throwsArgumentError); |
+ } |
} |
@reflectiveTest |