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