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

Unified Diff: pkg/analysis_server/test/resource_test.dart

Issue 345063005: Fix operator== and hashCode for File and Folder objects. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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/analysis_server/test/physical_resource_provider_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/resource_test.dart
diff --git a/pkg/analysis_server/test/resource_test.dart b/pkg/analysis_server/test/resource_test.dart
index ec1a67d10e5a2c077038c0fa9c16faa2bf004221..870ee819beba7f16d785dca0635ba78e3979cf51 100644
--- a/pkg/analysis_server/test/resource_test.dart
+++ b/pkg/analysis_server/test/resource_test.dart
@@ -223,6 +223,14 @@ main() {
File file = provider.getResource('/file.txt');
expect(file == file, isTrue);
});
+
+ test('before and after creation', () {
+ String path = '/file.txt';
+ File file1 = provider.getResource(path);
+ provider.newFile(path, 'contents');
+ File file2 = provider.getResource(path);
+ expect(file1 == file2, isTrue);
+ });
});
group('exists', () {
@@ -246,8 +254,11 @@ main() {
});
test('hashCode', () {
- File file = provider.getResource('/foo/bar/file.txt');
- file.hashCode;
+ String path = '/foo/bar/file.txt';
+ File file1 = provider.getResource(path);
+ provider.newFile(path, 'contents');
+ File file2 = provider.getResource(path);
+ expect(file1.hashCode, equals(file2.hashCode));
});
test('shortName', () {
@@ -271,9 +282,20 @@ main() {
group('Folder', () {
Folder folder;
+ const String path = '/foo/bar';
setUp(() {
- folder = provider.newFolder('/foo/bar');
+ folder = provider.newFolder(path);
+ });
+
+ test('hashCode', () {
+ Folder folder2 = provider.getResource(path);
+ expect(folder.hashCode, equals(folder2.hashCode));
+ });
+
+ test('equality', () {
+ Folder folder2 = provider.getResource(path);
+ expect(folder == folder2, isTrue);
scheglov 2014/07/02 00:32:56 Any test for a case when == returns false for memo
Paul Berry 2014/07/02 00:37:15 Good point. I'll add those.
});
group('getChild', () {
« no previous file with comments | « pkg/analysis_server/test/physical_resource_provider_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698