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

Side by Side Diff: pkg/analyzer/test/source/sdk_ext_test.dart

Issue 2344933002: Fix recently introduced strong-mode errors (Closed)
Patch Set: Created 4 years, 3 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.source.sdk_ext_test; 5 library analyzer.test.source.sdk_ext_test;
6 6
7 import 'package:analyzer/file_system/file_system.dart';
7 import 'package:analyzer/file_system/memory_file_system.dart'; 8 import 'package:analyzer/file_system/memory_file_system.dart';
8 import 'package:analyzer/source/sdk_ext.dart'; 9 import 'package:analyzer/source/sdk_ext.dart';
9 import 'package:test_reflective_loader/test_reflective_loader.dart'; 10 import 'package:test_reflective_loader/test_reflective_loader.dart';
10 import 'package:unittest/unittest.dart'; 11 import 'package:unittest/unittest.dart';
11 12
12 import '../utils.dart'; 13 import '../utils.dart';
13 14
14 main() { 15 main() {
15 initializeTestEnvironment(); 16 initializeTestEnvironment();
16 defineReflectiveTests(SdkExtUriResolverTest); 17 defineReflectiveTests(SdkExtUriResolverTest);
(...skipping 20 matching lines...) Expand all
37 } 38 }
38 39
39 test_create_badJSON() { 40 test_create_badJSON() {
40 var resolver = new SdkExtUriResolver(null); 41 var resolver = new SdkExtUriResolver(null);
41 resolver.addSdkExt(r'''{{{,{{}}},}}''', null); 42 resolver.addSdkExt(r'''{{{,{{}}},}}''', null);
42 expect(resolver.length, equals(0)); 43 expect(resolver.length, equals(0));
43 } 44 }
44 45
45 test_create_noSdkExtPackageMap() { 46 test_create_noSdkExtPackageMap() {
46 var resolver = new SdkExtUriResolver({ 47 var resolver = new SdkExtUriResolver({
47 'fox': [resourceProvider.getResource('/empty')] 48 'fox': <Folder>[resourceProvider.getResource('/empty')]
48 }); 49 });
49 expect(resolver.length, equals(0)); 50 expect(resolver.length, equals(0));
50 } 51 }
51 52
52 test_create_nullPackageMap() { 53 test_create_nullPackageMap() {
53 var resolver = new SdkExtUriResolver(null); 54 var resolver = new SdkExtUriResolver(null);
54 expect(resolver.length, equals(0)); 55 expect(resolver.length, equals(0));
55 } 56 }
56 57
57 test_create_sdkExtPackageMap() { 58 test_create_sdkExtPackageMap() {
58 var resolver = new SdkExtUriResolver({ 59 var resolver = new SdkExtUriResolver({
59 'fox': [resourceProvider.getResource('/tmp')] 60 'fox': <Folder>[resourceProvider.getResource('/tmp')]
60 }); 61 });
61 // We have four mappings. 62 // We have four mappings.
62 expect(resolver.length, equals(4)); 63 expect(resolver.length, equals(4));
63 // Check that they map to the correct paths. 64 // Check that they map to the correct paths.
64 expect(resolver['dart:fox'], equals("/tmp/slippy.dart")); 65 expect(resolver['dart:fox'], equals("/tmp/slippy.dart"));
65 expect(resolver['dart:bear'], equals("/tmp/grizzly.dart")); 66 expect(resolver['dart:bear'], equals("/tmp/grizzly.dart"));
66 expect(resolver['dart:relative'], equals("/relative.dart")); 67 expect(resolver['dart:relative'], equals("/relative.dart"));
67 expect(resolver['dart:deep'], equals("/tmp/deep/directory/file.dart")); 68 expect(resolver['dart:deep'], equals("/tmp/deep/directory/file.dart"));
68 } 69 }
69 70
70 test_restoreAbsolute() { 71 test_restoreAbsolute() {
71 var resolver = new SdkExtUriResolver({ 72 var resolver = new SdkExtUriResolver({
72 'fox': [resourceProvider.getResource('/tmp')] 73 'fox': <Folder>[resourceProvider.getResource('/tmp')]
73 }); 74 });
74 var source = resolver.resolveAbsolute(Uri.parse('dart:fox')); 75 var source = resolver.resolveAbsolute(Uri.parse('dart:fox'));
75 expect(source, isNotNull); 76 expect(source, isNotNull);
76 // Restore source's uri. 77 // Restore source's uri.
77 var restoreUri = resolver.restoreAbsolute(source); 78 var restoreUri = resolver.restoreAbsolute(source);
78 expect(restoreUri, isNotNull); 79 expect(restoreUri, isNotNull);
79 // Verify that it is 'dart:fox'. 80 // Verify that it is 'dart:fox'.
80 expect(restoreUri.toString(), equals('dart:fox')); 81 expect(restoreUri.toString(), equals('dart:fox'));
81 expect(restoreUri.scheme, equals('dart')); 82 expect(restoreUri.scheme, equals('dart'));
82 expect(restoreUri.path, equals('fox')); 83 expect(restoreUri.path, equals('fox'));
83 } 84 }
84 } 85 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698