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

Side by Side Diff: pkg/analyzer/test/file_system/resource_uri_resolver_test.dart

Issue 2393663002: More fixes for testing under windows (Closed)
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.test.file_system.resource_uri_resolver_test; 5 library analyzer.test.file_system.resource_uri_resolver_test;
6 6
7 import 'package:analyzer/file_system/file_system.dart'; 7 import 'package:analyzer/file_system/file_system.dart';
8 import 'package:analyzer/file_system/memory_file_system.dart'; 8 import 'package:analyzer/file_system/memory_file_system.dart';
9 import 'package:analyzer/src/generated/source.dart'; 9 import 'package:analyzer/src/generated/source.dart';
10 import 'package:test_reflective_loader/test_reflective_loader.dart'; 10 import 'package:test_reflective_loader/test_reflective_loader.dart';
11 import 'package:unittest/unittest.dart'; 11 import 'package:unittest/unittest.dart';
12 12
13 import '../utils.dart'; 13 import '../utils.dart';
14 14
15 main() { 15 main() {
16 initializeTestEnvironment(); 16 initializeTestEnvironment();
17 defineReflectiveTests(ResourceUriResolverTest); 17 defineReflectiveTests(ResourceUriResolverTest);
18 } 18 }
19 19
20 @reflectiveTest 20 @reflectiveTest
21 class ResourceUriResolverTest { 21 class ResourceUriResolverTest {
22 MemoryResourceProvider provider; 22 MemoryResourceProvider provider;
23 ResourceUriResolver resolver; 23 ResourceUriResolver resolver;
24 24
25 void setUp() { 25 void setUp() {
26 provider = new MemoryResourceProvider(); 26 provider = new MemoryResourceProvider();
27 resolver = new ResourceUriResolver(provider); 27 resolver = new ResourceUriResolver(provider);
28 provider.newFile('/test.dart', ''); 28 provider.newFile(provider.convertPath('/test.dart'), '');
29 provider.newFolder('/folder'); 29 provider.newFolder(provider.convertPath('/folder'));
30 } 30 }
31 31
32 void test_creation() { 32 void test_creation() {
33 expect(provider, isNotNull); 33 expect(provider, isNotNull);
34 expect(resolver, isNotNull); 34 expect(resolver, isNotNull);
35 } 35 }
36 36
37 void test_resolveAbsolute_file() { 37 void test_resolveAbsolute_file() {
38 var uri = new Uri(scheme: 'file', path: '/test.dart'); 38 var uri = provider.pathContext.toUri(provider.convertPath('/test.dart'));
39 Source source = resolver.resolveAbsolute(uri); 39 Source source = resolver.resolveAbsolute(uri);
40 expect(source, isNotNull); 40 expect(source, isNotNull);
41 expect(source.exists(), isTrue); 41 expect(source.exists(), isTrue);
42 expect(source.fullName, '/test.dart'); 42 expect(source.fullName, provider.convertPath('/test.dart'));
43 } 43 }
44 44
45 void test_resolveAbsolute_folder() { 45 void test_resolveAbsolute_folder() {
46 var uri = new Uri(scheme: 'file', path: '/folder'); 46 var uri = provider.pathContext.toUri(provider.convertPath('/folder'));
47 Source source = resolver.resolveAbsolute(uri); 47 Source source = resolver.resolveAbsolute(uri);
48 expect(source, isNull); 48 expect(source, isNull);
49 } 49 }
50 50
51 void test_resolveAbsolute_notFile_dartUri() { 51 void test_resolveAbsolute_notFile_dartUri() {
52 var uri = new Uri(scheme: 'dart', path: 'core'); 52 var uri = new Uri(scheme: 'dart', path: 'core');
53 Source source = resolver.resolveAbsolute(uri); 53 Source source = resolver.resolveAbsolute(uri);
54 expect(source, isNull); 54 expect(source, isNull);
55 } 55 }
56 56
57 void test_resolveAbsolute_notFile_httpsUri() { 57 void test_resolveAbsolute_notFile_httpsUri() {
58 var uri = new Uri(scheme: 'https', path: '127.0.0.1/test.dart'); 58 var uri = new Uri(scheme: 'https', path: '127.0.0.1/test.dart');
59 Source source = resolver.resolveAbsolute(uri); 59 Source source = resolver.resolveAbsolute(uri);
60 expect(source, isNull); 60 expect(source, isNull);
61 } 61 }
62 62
63 void test_restoreAbsolute() { 63 void test_restoreAbsolute() {
64 var uri = new Uri(scheme: 'file', path: '/test.dart'); 64 var uri = provider.pathContext.toUri(provider.convertPath('/test.dart'));
65 Source source = resolver.resolveAbsolute(uri); 65 Source source = resolver.resolveAbsolute(uri);
66 expect(source, isNotNull); 66 expect(source, isNotNull);
67 expect(resolver.restoreAbsolute(source), uri); 67 expect(resolver.restoreAbsolute(source), uri);
68 expect( 68 expect(
69 resolver.restoreAbsolute( 69 resolver.restoreAbsolute(
70 new NonExistingSource(source.fullName, null, null)), 70 new NonExistingSource(source.fullName, null, null)),
71 uri); 71 uri);
72 } 72 }
73 } 73 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/file_system/memory_file_system_test.dart ('k') | pkg/analyzer/test/generated/resolver_test_case.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698