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

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

Issue 351813002: A local file-based Index implementation. (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
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 a7e2b470733894d609b9c0452ad9388793fe70f3..7b8be72e8e151abf5262f8e13b1b156d3eac4983 100644
--- a/pkg/analysis_server/test/resource_test.dart
+++ b/pkg/analysis_server/test/resource_test.dart
@@ -10,7 +10,7 @@ import 'mocks.dart';
import 'package:analysis_server/src/resource.dart';
import 'package:analyzer/src/generated/engine.dart' show TimestampedData;
-import 'package:analyzer/src/generated/source_io.dart';
+import 'package:analyzer/src/generated/source.dart';
import 'package:path/path.dart';
import 'package:unittest/unittest.dart';
import 'package:watcher/watcher.dart';
@@ -423,8 +423,61 @@ main() {
});
});
});
+
+ group('ResourceUriResolver', _testResourceResourceUriResolver);
}
var _isFile = new isInstanceOf<File>();
var _isFolder = new isInstanceOf<Folder>();
var _isMemoryResourceException = new isInstanceOf<MemoryResourceException>();
+
+
+void _testResourceResourceUriResolver() {
Brian Wilkerson 2014/06/24 13:53:41 I don't understand the value of private names in t
scheglov 2014/06/24 15:21:23 Done.
+ MemoryResourceProvider provider;
+ ResourceUriResolver resolver;
+
+ setUp(() {
+ provider = new MemoryResourceProvider();
+ resolver = new ResourceUriResolver(provider);
+ provider.newFile('/test.dart', '');
+ provider.newFolder('/folder');
+ });
+
+ group('fromEncoding', () {
+ test('file', () {
+ var uri = new Uri(path: '/test.dart');
+ Source source = resolver.fromEncoding(UriKind.FILE_URI, uri);
+ expect(source, isNotNull);
+ expect(source.exists(), isTrue);
+ expect(source.fullName, '/test.dart');
+ });
+
+ test('not a UriKind.FILE_URI', () {
+ var uri = new Uri(path: '/test.dart');
+ Source source = resolver.fromEncoding(UriKind.DART_URI, uri);
+ expect(source, isNull);
+ });
+ });
+
+ group('resolveAbsolute', () {
+ test('file', () {
+ var uri = new Uri(scheme: 'file', path: '/test.dart');
+ Source source = resolver.resolveAbsolute(uri);
+ expect(source, isNotNull);
+ expect(source.exists(), isTrue);
+ expect(source.fullName, '/test.dart');
+ });
+
+ test('folder', () {
+ var uri = new Uri(scheme: 'file', path: '/folder');
+ Source source = resolver.resolveAbsolute(uri);
+ expect(source, isNull);
+ });
+
+ test('not a file URI', () {
+ var uri = new Uri(scheme: 'https', path: '127.0.0.1/test.dart');
+ Source source = resolver.resolveAbsolute(uri);
+ expect(source, isNull);
+ });
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698