| OLD | NEW |
| 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.services.completion.suggestion; | 5 library test.services.completion.suggestion; |
| 6 | 6 |
| 7 import 'package:analysis_services/completion/completion_computer.dart'; | 7 import 'package:analysis_services/completion/completion_computer.dart'; |
| 8 import 'package:analysis_services/src/completion/top_level_computer.dart'; | |
| 9 import 'package:analysis_testing/reflective_tests.dart'; | 8 import 'package:analysis_testing/reflective_tests.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 'completion_test_util.dart'; | 12 import 'completion_test_util.dart'; |
| 13 import 'package:analyzer/src/generated/source.dart'; | 13 import 'dart:async'; |
| 14 | 14 |
| 15 main() { | 15 main() { |
| 16 groupSep = ' | '; | 16 groupSep = ' | '; |
| 17 runReflectiveTests(CompletionManagerTest); | 17 runReflectiveTests(CompletionManagerTest); |
| 18 runReflectiveTests(DartCompletionManagerTest); | 18 runReflectiveTests(DartCompletionManagerTest); |
| 19 } | 19 } |
| 20 | 20 |
| 21 @ReflectiveTestCase() | 21 @ReflectiveTestCase() |
| 22 class CompletionManagerTest extends AbstractCompletionTest { | 22 class CompletionManagerTest extends AbstractCompletionTest { |
| 23 | 23 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 computers.forEach((c) { | 57 computers.forEach((c) { |
| 58 msg.writeln(' ${c.runtimeType}'); | 58 msg.writeln(' ${c.runtimeType}'); |
| 59 }); | 59 }); |
| 60 fail(msg.toString()); | 60 fail(msg.toString()); |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 test_topLevel() { | 64 test_topLevel() { |
| 65 Source source = addSource('/does/not/exist.dart', ''); | 65 Source source = addSource('/does/not/exist.dart', ''); |
| 66 var manager = new DartCompletionManager(source, 0, searchEngine); | 66 var manager = new DartCompletionManager(source, 0, searchEngine); |
| 67 manager.generate().then((List<CompletionComputer> computers) { | 67 bool anyResult; |
| 68 assertContainsType(computers, TopLevelComputer); | 68 manager.results().forEach((_) { |
| 69 expect(computers, hasLength(1)); | 69 anyResult = true; |
| 70 }); |
| 71 return new Future.delayed(Duration.ZERO, () { |
| 72 expect(anyResult, isTrue); |
| 70 }); | 73 }); |
| 71 } | 74 } |
| 72 } | 75 } |
| OLD | NEW |