OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 dartdoc_search_test; | 5 library dartdoc_search_test; |
6 | 6 |
7 // TODO(rnystrom): Use "package:" URL (#4968). | 7 // TODO(rnystrom): Use "package:" URL (#4968). |
| 8 import '../../../../../pkg/expect/lib/expect.dart'; |
8 import '../lib/src/dartdoc/nav.dart'; | 9 import '../lib/src/dartdoc/nav.dart'; |
9 import '../lib/src/client/search.dart'; | 10 import '../lib/src/client/search.dart'; |
10 | 11 |
11 const String URL = 'dummy-url'; | 12 const String URL = 'dummy-url'; |
12 | 13 |
13 testTopLevelVsMembers() { | 14 testTopLevelVsMembers() { |
14 var search = new SearchText('timer'); | 15 var search = new SearchText('timer'); |
15 var match = obtainMatch(search, 'timer'); | 16 var match = obtainMatch(search, 'timer'); |
16 // Matching a top-level field 'timer'; | 17 // Matching a top-level field 'timer'; |
17 var topLevelResult = new Result(match, FIELD, URL); | 18 var topLevelResult = new Result(match, FIELD, URL); |
(...skipping 25 matching lines...) Expand all Loading... |
43 var prefixResult = new Result(prefixMatch, FIELD, URL, type: 'Event'); | 44 var prefixResult = new Result(prefixMatch, FIELD, URL, type: 'Event'); |
44 Expect.equals(-1, resultComparator(fullResult, prefixResult), | 45 Expect.equals(-1, resultComparator(fullResult, prefixResult), |
45 "Full matches should be preferred to prefix matches"); | 46 "Full matches should be preferred to prefix matches"); |
46 } | 47 } |
47 | 48 |
48 void main() { | 49 void main() { |
49 testTopLevelVsMembers(); | 50 testTopLevelVsMembers(); |
50 testTopLevelFullVsPrefix(); | 51 testTopLevelFullVsPrefix(); |
51 testMemberFullVsPrefix(); | 52 testMemberFullVsPrefix(); |
52 } | 53 } |
OLD | NEW |