| 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.dart.keyword; | 5 library test.services.completion.dart.keyword; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/protocol.dart'; | 7 import 'package:analysis_server/src/protocol.dart'; |
| 8 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; | 8 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; |
| 9 import 'package:analysis_server/src/services/completion/keyword_contributor.dart
'; | 9 import 'package:analysis_server/src/services/completion/keyword_contributor.dart
'; |
| 10 import 'package:analyzer/src/generated/scanner.dart'; | 10 import 'package:analyzer/src/generated/scanner.dart'; |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 assertSuggestKeywords([Keyword.THIS]); | 510 assertSuggestKeywords([Keyword.THIS]); |
| 511 } | 511 } |
| 512 | 512 |
| 513 test_empty() { | 513 test_empty() { |
| 514 addTestSource('^'); | 514 addTestSource('^'); |
| 515 expect(computeFast(), isTrue); | 515 expect(computeFast(), isTrue); |
| 516 assertSuggestKeywords(DIRECTIVE_DECLARATION_AND_LIBRARY_KEYWORDS, | 516 assertSuggestKeywords(DIRECTIVE_DECLARATION_AND_LIBRARY_KEYWORDS, |
| 517 relevance: DART_RELEVANCE_HIGH); | 517 relevance: DART_RELEVANCE_HIGH); |
| 518 } | 518 } |
| 519 | 519 |
| 520 test_for_expression_in() { |
| 521 addTestSource('main() {for (int x i^)}'); |
| 522 expect(computeFast(), isTrue); |
| 523 assertSuggestKeywords([Keyword.IN], relevance: DART_RELEVANCE_HIGH); |
| 524 } |
| 525 |
| 526 test_for_expression_in2() { |
| 527 addTestSource('main() {for (int x in^)}'); |
| 528 expect(computeFast(), isTrue); |
| 529 assertSuggestKeywords([Keyword.IN], relevance: DART_RELEVANCE_HIGH); |
| 530 } |
| 531 |
| 532 test_for_expression_init() { |
| 533 addTestSource('main() {for (int x = i^)}'); |
| 534 expect(computeFast(), isTrue); |
| 535 assertSuggestKeywords( |
| 536 [Keyword.FALSE, Keyword.NEW, Keyword.NULL, Keyword.TRUE]); |
| 537 } |
| 538 |
| 539 test_for_expression_init2() { |
| 540 addTestSource('main() {for (int x = in^)}'); |
| 541 expect(computeFast(), isTrue); |
| 542 assertSuggestKeywords( |
| 543 [Keyword.FALSE, Keyword.NEW, Keyword.NULL, Keyword.TRUE]); |
| 544 } |
| 545 |
| 520 test_function_async() { | 546 test_function_async() { |
| 521 addTestSource('main()^'); | 547 addTestSource('main()^'); |
| 522 expect(computeFast(), isTrue); | 548 expect(computeFast(), isTrue); |
| 523 assertSuggestKeywords(DECLARATION_KEYWORDS, | 549 assertSuggestKeywords(DECLARATION_KEYWORDS, |
| 524 pseudoKeywords: ['async'], relevance: DART_RELEVANCE_HIGH); | 550 pseudoKeywords: ['async'], relevance: DART_RELEVANCE_HIGH); |
| 525 } | 551 } |
| 526 | 552 |
| 527 test_function_async2() { | 553 test_function_async2() { |
| 528 addTestSource('main()^{}'); | 554 addTestSource('main()^{}'); |
| 529 expect(computeFast(), isTrue); | 555 expect(computeFast(), isTrue); |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 (c) => msg.writeln(' $c, ${other.contains(c) ? '' : '<<<<<<<<<<<'}')); | 1194 (c) => msg.writeln(' $c, ${other.contains(c) ? '' : '<<<<<<<<<<<'}')); |
| 1169 } | 1195 } |
| 1170 | 1196 |
| 1171 bool _equalSets(Iterable<String> iter1, Iterable<String> iter2) { | 1197 bool _equalSets(Iterable<String> iter1, Iterable<String> iter2) { |
| 1172 if (iter1.length != iter2.length) return false; | 1198 if (iter1.length != iter2.length) return false; |
| 1173 if (iter1.any((c) => !iter2.contains(c))) return false; | 1199 if (iter1.any((c) => !iter2.contains(c))) return false; |
| 1174 if (iter2.any((c) => !iter1.contains(c))) return false; | 1200 if (iter2.any((c) => !iter1.contains(c))) return false; |
| 1175 return true; | 1201 return true; |
| 1176 } | 1202 } |
| 1177 } | 1203 } |
| OLD | NEW |