Chromium Code Reviews| 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() { | |
|
Brian Wilkerson
2015/08/10 13:56:18
It would be good to have some negative tests here
danrubel
2015/08/10 14:42:25
Good point. Added additional tests and handled new
| |
| 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() { | |
|
Brian Wilkerson
2015/08/10 13:56:18
I'm not sure what the utility is of suggesting 'in
danrubel
2015/08/10 14:42:25
It's good to ensure "in" is in the list of suggest
| |
| 527 addTestSource('main() {for (int x in^)}'); | |
| 528 expect(computeFast(), isTrue); | |
| 529 assertSuggestKeywords([Keyword.IN], relevance: DART_RELEVANCE_HIGH); | |
| 530 } | |
| 531 | |
| 520 test_function_async() { | 532 test_function_async() { |
| 521 addTestSource('main()^'); | 533 addTestSource('main()^'); |
| 522 expect(computeFast(), isTrue); | 534 expect(computeFast(), isTrue); |
| 523 assertSuggestKeywords(DECLARATION_KEYWORDS, | 535 assertSuggestKeywords(DECLARATION_KEYWORDS, |
| 524 pseudoKeywords: ['async'], relevance: DART_RELEVANCE_HIGH); | 536 pseudoKeywords: ['async'], relevance: DART_RELEVANCE_HIGH); |
| 525 } | 537 } |
| 526 | 538 |
| 527 test_function_async2() { | 539 test_function_async2() { |
| 528 addTestSource('main()^{}'); | 540 addTestSource('main()^{}'); |
| 529 expect(computeFast(), isTrue); | 541 expect(computeFast(), isTrue); |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1168 (c) => msg.writeln(' $c, ${other.contains(c) ? '' : '<<<<<<<<<<<'}')); | 1180 (c) => msg.writeln(' $c, ${other.contains(c) ? '' : '<<<<<<<<<<<'}')); |
| 1169 } | 1181 } |
| 1170 | 1182 |
| 1171 bool _equalSets(Iterable<String> iter1, Iterable<String> iter2) { | 1183 bool _equalSets(Iterable<String> iter1, Iterable<String> iter2) { |
| 1172 if (iter1.length != iter2.length) return false; | 1184 if (iter1.length != iter2.length) return false; |
| 1173 if (iter1.any((c) => !iter2.contains(c))) return false; | 1185 if (iter1.any((c) => !iter2.contains(c))) return false; |
| 1174 if (iter2.any((c) => !iter1.contains(c))) return false; | 1186 if (iter2.any((c) => !iter1.contains(c))) return false; |
| 1175 return true; | 1187 return true; |
| 1176 } | 1188 } |
| 1177 } | 1189 } |
| OLD | NEW |