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

Side by Side Diff: pkg/analysis_services/test/completion/completion_computer_test.dart

Issue 428313002: refactor code completion to allow for multiple suggestion computers (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 4 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library test.services.completion.suggestion;
6
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/abstract_single_unit.dart';
10 import 'package:analysis_testing/reflective_tests.dart';
11 import 'package:unittest/unittest.dart';
12
13 main() {
14 groupSep = ' | ';
15 runReflectiveTests(CompletionComputerTest);
16 }
17
18 @ReflectiveTestCase()
19 class CompletionComputerTest extends AbstractSingleUnitTest {
20
21 test_topLevel() {
22 CompletionComputer.create(null).then((computers) {
23 assertContainsType(computers, TopLevelComputer);
24 expect(computers, hasLength(1));
25 });
26 }
27
28 /// Assert that the list contains exactly one of the given type
29 void assertContainsType(List computers, Type type) {
30 int count = 0;
31 computers.forEach((c) {
32 if (c.runtimeType == type) {
33 ++count;
34 }
35 });
36 if (count != 1) {
37 var msg = new StringBuffer();
38 msg.writeln('Expected $type, but found:');
39 computers.forEach((c) {
40 msg.writeln(' ${c.runtimeType}');
41 });
42 fail(msg.toString());
43 }
44 }
45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698