| OLD | NEW |
| 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 test.services.dependencies.import_collector; | 5 library test.services.dependencies.import_collector; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/services/dependencies/reachable_source_colle
ctor.dart'; | 7 import 'package:analysis_server/src/services/dependencies/reachable_source_colle
ctor.dart'; |
| 8 import 'package:analyzer/dart/ast/ast.dart'; | |
| 9 import 'package:analyzer/src/generated/source.dart'; | 8 import 'package:analyzer/src/generated/source.dart'; |
| 10 import 'package:test/test.dart'; | 9 import 'package:test/test.dart'; |
| 11 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 10 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 12 | 11 |
| 13 import '../../abstract_context.dart'; | 12 import '../../abstract_context.dart'; |
| 14 | 13 |
| 15 main() { | 14 main() { |
| 16 defineReflectiveSuite(() { | 15 defineReflectiveSuite(() { |
| 17 defineReflectiveTests(ReachableSourceCollectorTest); | 16 defineReflectiveTests(ReachableSourceCollectorTest); |
| 18 }); | 17 }); |
| 19 } | 18 } |
| 20 | 19 |
| 21 @reflectiveTest | 20 @reflectiveTest |
| 22 class ReachableSourceCollectorTest extends AbstractContextTest { | 21 class ReachableSourceCollectorTest extends AbstractContextTest { |
| 23 CompilationUnit addLibrary(String path, String contents) => | |
| 24 resolveLibraryUnit(addSource(path, contents)); | |
| 25 | |
| 26 Map<String, List<String>> importsFor(Source source) => | 22 Map<String, List<String>> importsFor(Source source) => |
| 27 new ReachableSourceCollector(source, context).collectSources(); | 23 new ReachableSourceCollector(source, context).collectSources(); |
| 28 | 24 |
| 29 test_null_context() { | 25 test_null_context() { |
| 30 Source lib = addSource('/lib.dart', ''); | 26 Source lib = addSource('/lib.dart', ''); |
| 31 expect(() => new ReachableSourceCollector(lib, null), | 27 expect(() => new ReachableSourceCollector(lib, null), |
| 32 throwsA(new isInstanceOf<ArgumentError>())); | 28 throwsA(new isInstanceOf<ArgumentError>())); |
| 33 } | 29 } |
| 34 | 30 |
| 35 test_null_source() { | 31 test_null_source() { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 66 // Cycles should be OK. | 62 // Cycles should be OK. |
| 67 { | 63 { |
| 68 Map<String, List<String>> imports = importsFor(lib3); | 64 Map<String, List<String>> imports = importsFor(lib3); |
| 69 expect(imports.keys, contains('file:///lib3.dart')); | 65 expect(imports.keys, contains('file:///lib3.dart')); |
| 70 expect(imports.keys, contains('file:///lib4.dart')); | 66 expect(imports.keys, contains('file:///lib4.dart')); |
| 71 expect(imports.keys, contains('dart:core')); | 67 expect(imports.keys, contains('dart:core')); |
| 72 expect(imports.keys, contains('dart:math')); | 68 expect(imports.keys, contains('dart:math')); |
| 73 } | 69 } |
| 74 } | 70 } |
| 75 } | 71 } |
| OLD | NEW |