Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Unified Diff: pkg/analyzer/test/file_system/physical_resource_provider_test.dart

Issue 2270593003: Add support for resolving symbolic links (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: comment clean-up Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/test/file_system/memory_file_system_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/file_system/physical_resource_provider_test.dart
diff --git a/pkg/analyzer/test/file_system/physical_resource_provider_test.dart b/pkg/analyzer/test/file_system/physical_resource_provider_test.dart
index 88bd9615299ef7071e7c1af16262660aedce18ae..0308293ebcdad09ee4e9b660bed74e4084b18a64 100644
--- a/pkg/analyzer/test/file_system/physical_resource_provider_test.dart
+++ b/pkg/analyzer/test/file_system/physical_resource_provider_test.dart
@@ -180,6 +180,43 @@ class FileTest extends _BaseTest {
expect(file.exists, isTrue);
}
+ void test_resolveSymbolicLinksSync_links() {
+ Context pathContext = PhysicalResourceProvider.INSTANCE.pathContext;
+ String pathA = pathContext.join(tempPath, 'a');
+ String pathB = pathContext.join(pathA, 'b');
+ new io.Directory(pathB).createSync(recursive: true);
+ String filePath = pathContext.join(pathB, 'test.txt');
+ io.File testFile = new io.File(filePath);
+ testFile.writeAsStringSync('test');
+
+ String pathC = pathContext.join(tempPath, 'c');
+ String pathD = pathContext.join(pathC, 'd');
+ new io.Link(pathD).createSync(pathA, recursive: true);
+
+ String pathE = pathContext.join(tempPath, 'e');
+ String pathF = pathContext.join(pathE, 'f');
+ new io.Link(pathF).createSync(pathC, recursive: true);
+
+ String linkPath =
+ pathContext.join(tempPath, 'e', 'f', 'd', 'b', 'test.txt');
+ File file = PhysicalResourceProvider.INSTANCE.getFile(linkPath);
+ expect(file.resolveSymbolicLinksSync().path,
+ testFile.resolveSymbolicLinksSync());
+ }
+
+ void test_resolveSymbolicLinksSync_noLinks() {
+ //
+ // On some platforms the path to the temp directory includes a symbolic
+ // link. We remove that from the equation before creating the File in order
+ // to show that the operation works as expected without symbolic links.
+ //
+ io.File ioFile = new io.File(path);
+ ioFile.writeAsStringSync('test');
+ file = PhysicalResourceProvider.INSTANCE
+ .getFile(ioFile.resolveSymbolicLinksSync());
+ expect(file.resolveSymbolicLinksSync(), file);
+ }
+
void test_shortName() {
expect(file.shortName, 'file.txt');
}
« no previous file with comments | « pkg/analyzer/test/file_system/memory_file_system_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698