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

Unified Diff: packages/analyzer/test/file_system/resource_uri_resolver_test.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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: packages/analyzer/test/file_system/resource_uri_resolver_test.dart
diff --git a/packages/analyzer/test/file_system/resource_uri_resolver_test.dart b/packages/analyzer/test/file_system/resource_uri_resolver_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..8d91d2454dd517b54ee4e1cc9f00f3af34faab0c
--- /dev/null
+++ b/packages/analyzer/test/file_system/resource_uri_resolver_test.dart
@@ -0,0 +1,62 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library test.resource_uri_resolver;
+
+import 'package:analyzer/file_system/file_system.dart';
+import 'package:analyzer/file_system/memory_file_system.dart';
+import 'package:analyzer/src/generated/source.dart';
+import 'package:unittest/unittest.dart';
+
+import '../reflective_tests.dart';
+import '../utils.dart';
+
+main() {
+ initializeTestEnvironment();
+ runReflectiveTests(ResourceUriResolverTest);
+}
+
+@reflectiveTest
+class ResourceUriResolverTest {
+ MemoryResourceProvider provider;
+ ResourceUriResolver resolver;
+
+ void setUp() {
+ provider = new MemoryResourceProvider();
+ resolver = new ResourceUriResolver(provider);
+ provider.newFile('/test.dart', '');
+ provider.newFolder('/folder');
+ }
+
+ void test_resolveAbsolute_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');
+ }
+
+ void test_resolveAbsolute_folder() {
+ var uri = new Uri(scheme: 'file', path: '/folder');
+ Source source = resolver.resolveAbsolute(uri);
+ expect(source, isNull);
+ }
+
+ void test_resolveAbsolute_notFile() {
+ var uri = new Uri(scheme: 'https', path: '127.0.0.1/test.dart');
+ Source source = resolver.resolveAbsolute(uri);
+ expect(source, isNull);
+ }
+
+ void test_restoreAbsolute() {
+ var uri = new Uri(scheme: 'file', path: '/test.dart');
+ Source source = resolver.resolveAbsolute(uri);
+ expect(source, isNotNull);
+ expect(resolver.restoreAbsolute(source), uri);
+ expect(
+ resolver.restoreAbsolute(
+ new NonExistingSource(source.fullName, null, null)),
+ uri);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698