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.search.search_result; | 5 library test.search.search_result; |
6 | 6 |
7 import 'package:analysis_server/src/protocol_server.dart'; | 7 import 'package:analysis_server/src/protocol_server.dart'; |
8 import 'package:analysis_server/src/services/search/search_engine.dart'; | 8 import 'package:analysis_server/src/services/search/search_engine.dart'; |
9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
10 | 10 |
11 import '../reflective_tests.dart'; | 11 import '../reflective_tests.dart'; |
12 | 12 |
13 | |
14 main() { | 13 main() { |
15 groupSep = ' | '; | 14 groupSep = ' | '; |
16 runReflectiveTests(SearchResultKindTest); | 15 runReflectiveTests(SearchResultKindTest); |
17 } | 16 } |
18 | 17 |
19 | |
20 @reflectiveTest | 18 @reflectiveTest |
21 class SearchResultKindTest { | 19 class SearchResultKindTest { |
22 void test_fromEngine() { | 20 void test_fromEngine() { |
23 expect( | 21 expect(newSearchResultKind_fromEngine(MatchKind.DECLARATION), |
24 newSearchResultKind_fromEngine(MatchKind.DECLARATION), | |
25 SearchResultKind.DECLARATION); | 22 SearchResultKind.DECLARATION); |
26 expect( | 23 expect( |
27 newSearchResultKind_fromEngine(MatchKind.READ), | 24 newSearchResultKind_fromEngine(MatchKind.READ), SearchResultKind.READ); |
28 SearchResultKind.READ); | 25 expect(newSearchResultKind_fromEngine(MatchKind.READ_WRITE), |
29 expect( | |
30 newSearchResultKind_fromEngine(MatchKind.READ_WRITE), | |
31 SearchResultKind.READ_WRITE); | 26 SearchResultKind.READ_WRITE); |
32 expect( | 27 expect(newSearchResultKind_fromEngine(MatchKind.WRITE), |
33 newSearchResultKind_fromEngine(MatchKind.WRITE), | |
34 SearchResultKind.WRITE); | 28 SearchResultKind.WRITE); |
35 expect( | 29 expect(newSearchResultKind_fromEngine(MatchKind.REFERENCE), |
36 newSearchResultKind_fromEngine(MatchKind.REFERENCE), | |
37 SearchResultKind.REFERENCE); | 30 SearchResultKind.REFERENCE); |
38 expect( | 31 expect(newSearchResultKind_fromEngine(MatchKind.INVOCATION), |
39 newSearchResultKind_fromEngine(MatchKind.INVOCATION), | |
40 SearchResultKind.INVOCATION); | 32 SearchResultKind.INVOCATION); |
41 expect(newSearchResultKind_fromEngine(null), SearchResultKind.UNKNOWN); | 33 expect(newSearchResultKind_fromEngine(null), SearchResultKind.UNKNOWN); |
42 } | 34 } |
43 | 35 |
44 void test_fromName() { | 36 void test_fromName() { |
45 expect( | 37 expect(new SearchResultKind(SearchResultKind.DECLARATION.name), |
46 new SearchResultKind(SearchResultKind.DECLARATION.name), | |
47 SearchResultKind.DECLARATION); | 38 SearchResultKind.DECLARATION); |
48 expect( | 39 expect(new SearchResultKind(SearchResultKind.READ.name), |
49 new SearchResultKind(SearchResultKind.READ.name), | |
50 SearchResultKind.READ); | 40 SearchResultKind.READ); |
51 expect( | 41 expect(new SearchResultKind(SearchResultKind.READ_WRITE.name), |
52 new SearchResultKind(SearchResultKind.READ_WRITE.name), | |
53 SearchResultKind.READ_WRITE); | 42 SearchResultKind.READ_WRITE); |
54 expect( | 43 expect(new SearchResultKind(SearchResultKind.WRITE.name), |
55 new SearchResultKind(SearchResultKind.WRITE.name), | |
56 SearchResultKind.WRITE); | 44 SearchResultKind.WRITE); |
57 expect( | 45 expect(new SearchResultKind(SearchResultKind.REFERENCE.name), |
58 new SearchResultKind(SearchResultKind.REFERENCE.name), | |
59 SearchResultKind.REFERENCE); | 46 SearchResultKind.REFERENCE); |
60 expect( | 47 expect(new SearchResultKind(SearchResultKind.INVOCATION.name), |
61 new SearchResultKind(SearchResultKind.INVOCATION.name), | |
62 SearchResultKind.INVOCATION); | 48 SearchResultKind.INVOCATION); |
63 expect( | 49 expect(new SearchResultKind(SearchResultKind.UNKNOWN.name), |
64 new SearchResultKind(SearchResultKind.UNKNOWN.name), | |
65 SearchResultKind.UNKNOWN); | 50 SearchResultKind.UNKNOWN); |
66 } | 51 } |
67 | 52 |
68 void test_toString() { | 53 void test_toString() { |
69 expect( | 54 expect(SearchResultKind.DECLARATION.toString(), |
70 SearchResultKind.DECLARATION.toString(), | |
71 'SearchResultKind.DECLARATION'); | 55 'SearchResultKind.DECLARATION'); |
72 } | 56 } |
73 } | 57 } |
OLD | NEW |