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

Unified Diff: pkg/analysis_server/test/integration/analysis_domain_inttest.dart

Issue 430433002: Add integration tests for analysis.getErrors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | « no previous file | pkg/analysis_server/test/integration/integration_tests.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/integration/analysis_domain_inttest.dart
diff --git a/pkg/analysis_server/test/integration/analysis_domain_inttest.dart b/pkg/analysis_server/test/integration/analysis_domain_inttest.dart
index 090e8e681a6b0dccf58245267af696b786add4bc..04b064e5fe164207d06acdd7b02ece668f17f730 100644
--- a/pkg/analysis_server/test/integration/analysis_domain_inttest.dart
+++ b/pkg/analysis_server/test/integration/analysis_domain_inttest.dart
@@ -139,8 +139,7 @@ main() {
test_getHover_noInfo() {
String filename = 'test.dart';
String pathname = normalizePath(filename);
- String text =
- r'''
+ String text = r'''
main() {
// no code
}
@@ -153,14 +152,48 @@ main() {
// request is made. So wait for analysis to finish before testing anything.
return analysisFinished.then((_) {
return server.send(ANALYSIS_GET_HOVER, {
- 'file': pathname,
- 'offset': text.indexOf('no code')
- }).then((result) {
- expect(result, isAnalysisGetHoverResult);
- expect(result['hovers'], hasLength(0));
+ 'file': pathname,
+ 'offset': text.indexOf('no code')
+ }).then((result) {
+ expect(result, isAnalysisGetHoverResult);
+ expect(result['hovers'], hasLength(0));
});
});
}
+
+ test_getErrors_before_analysis() {
+ return getErrorsTest(false);
+ }
+
+ test_getErrors_after_analysis() {
+ debugStdio();
+ return getErrorsTest(true);
+ }
+
+ Future getErrorsTest(bool afterAnalysis) {
+ String filename = 'test.dart';
+ String pathname = normalizePath(filename);
+ String text =
+ r'''
+ main() {
+ var x // parse error: missing ';'
+ }''';
+ writeFile(filename, text);
+ setAnalysisRoots(['']);
+ Future finishTest() {
+ return server.send(ANALYSIS_GET_ERRORS, {
+ 'file': pathname
+ }).then((result) {
+ expect(result, isAnalysisGetErrorsResult);
+ expect(result['errors'], equals(currentAnalysisErrors[pathname]));
+ });
+ }
+ if (afterAnalysis) {
+ return analysisFinished.then((_) => finishTest());
+ } else {
+ return finishTest();
+ }
+ }
}
main() {
« no previous file with comments | « no previous file | pkg/analysis_server/test/integration/integration_tests.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698