Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: pkg/analysis_server/test/search/top_level_declarations_test.dart

Issue 2149853002: Handle bad regexs in search.findTopLevelDeclarations. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: updates from review Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/search/search_domain.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/search/top_level_declarations_test.dart
diff --git a/pkg/analysis_server/test/search/top_level_declarations_test.dart b/pkg/analysis_server/test/search/top_level_declarations_test.dart
index 81fa08b749478c62191201a78d2db826a4988f2f..e9be56a3bdeda094feda10c81aafa93e27d9c7a0 100644
--- a/pkg/analysis_server/test/search/top_level_declarations_test.dart
+++ b/pkg/analysis_server/test/search/top_level_declarations_test.dart
@@ -39,6 +39,9 @@ class TopLevelDeclarationsTest extends AbstractSearchDomainTest {
Request request =
new SearchFindTopLevelDeclarationsParams(pattern).toRequest('0');
Response response = await waitResponse(request);
+ if (response.error != null) {
+ return response.error;
+ }
searchId =
new SearchFindTopLevelDeclarationsResult.fromResponse(response).id;
return waitForSearchResults();
@@ -63,6 +66,7 @@ D() {}
var E = null;
class ABC {}
''');
+
await findTopLevelDeclarations('^[A-E]\$');
assertHasDeclaration(ElementKind.CLASS, 'A');
assertHasDeclaration(ElementKind.CLASS, 'B');
@@ -71,4 +75,9 @@ class ABC {}
assertHasDeclaration(ElementKind.TOP_LEVEL_VARIABLE, 'E');
assertNoDeclaration(ElementKind.CLASS, 'ABC');
}
+
+ test_invalidRegex() async {
+ var result = await findTopLevelDeclarations('[A');
+ expect(result, new isInstanceOf<RequestError>());
+ }
}
« no previous file with comments | « pkg/analysis_server/lib/src/search/search_domain.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698