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

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

Issue 1000473002: Convert file system tests into reflective. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/test/file_system/physical_resource_provider_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 test.resource_uri_resolver; 5 library test.resource_uri_resolver;
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:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
11 11
12 import '../reflective_tests.dart';
13
12 main() { 14 main() {
13 groupSep = ' | '; 15 groupSep = ' | ';
14 group('ResourceUriResolver', () { 16 runReflectiveTests(ResourceUriResolverTest);
15 MemoryResourceProvider provider; 17 }
16 ResourceUriResolver resolver;
17 18
18 setUp(() { 19 @reflectiveTest
19 provider = new MemoryResourceProvider(); 20 class ResourceUriResolverTest {
20 resolver = new ResourceUriResolver(provider); 21 MemoryResourceProvider provider;
21 provider.newFile('/test.dart', ''); 22 ResourceUriResolver resolver;
22 provider.newFolder('/folder');
23 });
24 23
25 group('resolveAbsolute', () { 24 void setUp() {
26 test('file', () { 25 provider = new MemoryResourceProvider();
27 var uri = new Uri(scheme: 'file', path: '/test.dart'); 26 resolver = new ResourceUriResolver(provider);
28 Source source = resolver.resolveAbsolute(uri); 27 provider.newFile('/test.dart', '');
29 expect(source, isNotNull); 28 provider.newFolder('/folder');
30 expect(source.exists(), isTrue); 29 }
31 expect(source.fullName, '/test.dart');
32 });
33 30
34 test('folder', () { 31 void test_resolveAbsolute_file() {
35 var uri = new Uri(scheme: 'file', path: '/folder'); 32 var uri = new Uri(scheme: 'file', path: '/test.dart');
36 Source source = resolver.resolveAbsolute(uri); 33 Source source = resolver.resolveAbsolute(uri);
37 expect(source, isNull); 34 expect(source, isNotNull);
38 }); 35 expect(source.exists(), isTrue);
36 expect(source.fullName, '/test.dart');
37 }
39 38
40 test('not a file URI', () { 39 void test_resolveAbsolute_folder() {
41 var uri = new Uri(scheme: 'https', path: '127.0.0.1/test.dart'); 40 var uri = new Uri(scheme: 'file', path: '/folder');
42 Source source = resolver.resolveAbsolute(uri); 41 Source source = resolver.resolveAbsolute(uri);
43 expect(source, isNull); 42 expect(source, isNull);
44 }); 43 }
45 }); 44
46 }); 45 void test_resolveAbsolute_notFile() {
46 var uri = new Uri(scheme: 'https', path: '127.0.0.1/test.dart');
47 Source source = resolver.resolveAbsolute(uri);
48 expect(source, isNull);
49 }
50
51 void test_restoreAbsolute() {
52 var uri = new Uri(scheme: 'file', path: '/test.dart');
53 Source source = resolver.resolveAbsolute(uri);
54 expect(source, isNotNull);
55 expect(resolver.restoreAbsolute(source), uri);
56 }
47 } 57 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/file_system/physical_resource_provider_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698