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

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

Issue 484733003: Import analysis_services.dart into analysis_server.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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.dart.keyword;
6
7 import 'package:analysis_services/completion/completion_suggestion.dart';
8 import 'package:analysis_services/src/completion/keyword_computer.dart';
9 import 'package:analysis_testing/reflective_tests.dart';
10 import 'package:analyzer/src/generated/scanner.dart';
11 import 'package:unittest/unittest.dart';
12
13 import 'completion_test_util.dart';
14
15 main() {
16 groupSep = ' | ';
17 runReflectiveTests(KeywordComputerTest);
18 }
19
20 @ReflectiveTestCase()
21 class KeywordComputerTest extends AbstractCompletionTest {
22
23 void assertSuggestKeywords(List<String> names) {
24 Keyword.values.forEach((Keyword keyword) {
25 if (names.contains(keyword.syntax)) {
26 assertSuggest(CompletionSuggestionKind.KEYWORD, keyword.syntax);
27 } else {
28 assertNotSuggested(keyword.syntax);
29 }
30 });
31 }
32
33 @override
34 void setUp() {
35 super.setUp();
36 computer = new KeywordComputer();
37 }
38
39 test_class_extends() {
40 addTestSource('class A ^');
41 expect(computeFast(), isTrue);
42 assertSuggestKeywords(['extends', 'implements', 'with']);
43 }
44
45 test_class_extends_name() {
46 addTestSource('class A extends ^');
47 expect(computeFast(), isTrue);
48 assertSuggestKeywords([]);
49 }
50
51 test_class_name() {
52 addTestSource('class ^');
53 expect(computeFast(), isTrue);
54 assertSuggestKeywords([]);
55 }
56
57 test_empty() {
58 addTestSource('^');
59 expect(computeFast(), isTrue);
60 assertSuggestKeywords(
61 [
62 'abstract',
63 'class',
64 'const',
65 'export',
66 'final',
67 'import',
68 'library',
69 'part',
70 'typedef',
71 'var']);
72 }
73 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698