| 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.src.search.search_engine_internal; | 5 library test.services.src.search.search_engine_internal; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/services/index/index.dart'; | 9 import 'package:analysis_server/src/services/index/index.dart'; |
| 10 import 'package:analysis_server/src/services/search/search_engine.dart'; | 10 import 'package:analysis_server/src/services/search/search_engine.dart'; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 final MatchKind kind; | 29 final MatchKind kind; |
| 30 SourceRange range; | 30 SourceRange range; |
| 31 final bool isResolved; | 31 final bool isResolved; |
| 32 final bool isQualified; | 32 final bool isQualified; |
| 33 | 33 |
| 34 ExpectedMatch(this.element, this.kind, int offset, int length, | 34 ExpectedMatch(this.element, this.kind, int offset, int length, |
| 35 {this.isResolved: true, this.isQualified: false}) { | 35 {this.isResolved: true, this.isQualified: false}) { |
| 36 this.range = new SourceRange(offset, length); | 36 this.range = new SourceRange(offset, length); |
| 37 } | 37 } |
| 38 | 38 |
| 39 bool operator ==(SearchMatch match) { | 39 bool operator ==(Object match) { |
| 40 return match.element == this.element && | 40 return match is SearchMatch && |
| 41 match.element == this.element && |
| 41 match.kind == this.kind && | 42 match.kind == this.kind && |
| 42 match.isResolved == this.isResolved && | 43 match.isResolved == this.isResolved && |
| 43 match.isQualified == this.isQualified && | 44 match.isQualified == this.isQualified && |
| 44 match.sourceRange == this.range; | 45 match.sourceRange == this.range; |
| 45 } | 46 } |
| 46 | 47 |
| 47 @override | 48 @override |
| 48 String toString() { | 49 String toString() { |
| 49 StringBuffer buffer = new StringBuffer(); | 50 StringBuffer buffer = new StringBuffer(); |
| 50 buffer.write("ExpectedMatch(kind="); | 51 buffer.write("ExpectedMatch(kind="); |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 List<SearchMatch> matches = await searchEngine.searchReferences(element); | 899 List<SearchMatch> matches = await searchEngine.searchReferences(element); |
| 899 _assertMatches(matches, expectedMatches); | 900 _assertMatches(matches, expectedMatches); |
| 900 expect(matches, hasLength(expectedMatches.length)); | 901 expect(matches, hasLength(expectedMatches.length)); |
| 901 } | 902 } |
| 902 | 903 |
| 903 static void _assertMatches( | 904 static void _assertMatches( |
| 904 List<SearchMatch> matches, List<ExpectedMatch> expectedMatches) { | 905 List<SearchMatch> matches, List<ExpectedMatch> expectedMatches) { |
| 905 expect(matches, unorderedEquals(expectedMatches)); | 906 expect(matches, unorderedEquals(expectedMatches)); |
| 906 } | 907 } |
| 907 } | 908 } |
| OLD | NEW |