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

Unified Diff: tests/standalone/io/link_test.dart

Issue 12850010: Add FileSystemEntity.identical, to test if two file system objects are the same. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Change argument names from file1, file2 to path1, path2. Created 7 years, 9 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 | « sdk/lib/io/file_system_entity.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/link_test.dart
diff --git a/tests/standalone/io/link_test.dart b/tests/standalone/io/link_test.dart
index 6a404c05cc645d34aac300aadfb80f32d12a7195..ae303a772ec4b75710c5867f9d18f2fa6d751f64 100644
--- a/tests/standalone/io/link_test.dart
+++ b/tests/standalone/io/link_test.dart
@@ -48,6 +48,34 @@ testCreateSync() {
Expect.equals(FileSystemEntityType.DIRECTORY,
FileSystemEntity.typeSync(createdDirectly, followLinks: false));
+ // Test FileSystemEntity.identical on files, directories, and links,
+ // reached by different paths.
+ Expect.isTrue(FileSystemEntity.identicalSync(createdDirectly,
+ createdDirectly));
+ Expect.isFalse(FileSystemEntity.identicalSync(createdDirectly,
+ createdThroughLink));
+ Expect.isTrue(FileSystemEntity.identicalSync(createdDirectly,
+ base.append('link/createdDirectly').toNativePath()));
+ Expect.isTrue(FileSystemEntity.identicalSync(createdThroughLink,
+ base.append('target/createdThroughLink').toNativePath()));
+
+ Expect.isFalse(FileSystemEntity.identicalSync(target, link));
+ Expect.isTrue(FileSystemEntity.identicalSync(link, link));
+ Expect.isTrue(FileSystemEntity.identicalSync(target, target));
+ Expect.isTrue(FileSystemEntity.identicalSync(target,
+ new Link(link).targetSync()));
+ String absolutePath = new File(".").fullPathSync();
+ Expect.isTrue(FileSystemEntity.identicalSync(".", absolutePath));
+
+ String createdFile = base.append('target/createdFile').toNativePath();
+ new File(createdFile).createSync();
+ Expect.isTrue(FileSystemEntity.identicalSync(createdFile, createdFile));
+ Expect.isFalse(FileSystemEntity.identicalSync(createdFile, createdDirectly));
+ Expect.isTrue(FileSystemEntity.identicalSync(createdFile,
+ base.append('link/createdFile').toNativePath()));
+ Expect.throws(() => FileSystemEntity.identicalSync(createdFile,
+ base.append('link/foo').toNativePath()));
+
new Directory.fromPath(base).deleteSync(recursive: true);
}
« no previous file with comments | « sdk/lib/io/file_system_entity.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698