| 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/keyword_computer.dart'; | 8 import 'package:analysis_server/src/services/completion/keyword_computer.dart'; |
| 9 import 'package:analyzer/src/generated/scanner.dart'; | 9 import 'package:analyzer/src/generated/scanner.dart'; |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 StringBuffer msg = new StringBuffer(); | 53 StringBuffer msg = new StringBuffer(); |
| 54 msg.writeln('Expected:'); | 54 msg.writeln('Expected:'); |
| 55 _appendKeywords(msg, expectedKeywords); | 55 _appendKeywords(msg, expectedKeywords); |
| 56 msg.writeln('but found:'); | 56 msg.writeln('but found:'); |
| 57 _appendKeywords(msg, actualKeywords); | 57 _appendKeywords(msg, actualKeywords); |
| 58 fail(msg.toString()); | 58 fail(msg.toString()); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 @override | 62 @override |
| 63 void setUp() { | 63 void setUpComputer() { |
| 64 super.setUp(); | |
| 65 computer = new KeywordComputer(); | 64 computer = new KeywordComputer(); |
| 66 } | 65 } |
| 67 | 66 |
| 68 test_after_class() { | 67 test_after_class() { |
| 69 addTestSource('class A {} ^'); | 68 addTestSource('class A {} ^'); |
| 70 expect(computeFast(), isTrue); | 69 expect(computeFast(), isTrue); |
| 71 assertSuggestKeywords( | 70 assertSuggestKeywords( |
| 72 [ | 71 [ |
| 73 Keyword.ABSTRACT, | 72 Keyword.ABSTRACT, |
| 74 Keyword.CLASS, | 73 Keyword.CLASS, |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 sorted.forEach((k) => msg.writeln(' Keyword.${k.name},')); | 306 sorted.forEach((k) => msg.writeln(' Keyword.${k.name},')); |
| 308 } | 307 } |
| 309 | 308 |
| 310 bool _equalSets(Iterable<Keyword> iter1, Iterable<Keyword> iter2) { | 309 bool _equalSets(Iterable<Keyword> iter1, Iterable<Keyword> iter2) { |
| 311 if (iter1.length != iter2.length) return false; | 310 if (iter1.length != iter2.length) return false; |
| 312 if (iter1.any((k) => !iter2.contains(k))) return false; | 311 if (iter1.any((k) => !iter2.contains(k))) return false; |
| 313 if (iter2.any((k) => !iter1.contains(k))) return false; | 312 if (iter2.any((k) => !iter1.contains(k))) return false; |
| 314 return true; | 313 return true; |
| 315 } | 314 } |
| 316 } | 315 } |
| OLD | NEW |